[Yt-svn] yt-commit r368 - trunk/yt

mturk at wrangler.dreamhost.com mturk at wrangler.dreamhost.com
Thu Jan 24 22:48:51 PST 2008


Author: mturk
Date: Thu Jan 24 22:48:51 2008
New Revision: 368
URL: http://yt.spacepope.org/changeset/368

Log:
Added the "just_one" function, which can come in handy for non-iterables,
iterables, etc.



Modified:
   trunk/yt/funcs.py

Modified: trunk/yt/funcs.py
==============================================================================
--- trunk/yt/funcs.py	(original)
+++ trunk/yt/funcs.py	Thu Jan 24 22:48:51 2008
@@ -67,6 +67,11 @@
     def finish(sefl, *args, **kwargs):
         return
 
+def just_one(obj):
+    if iterable(obj):
+        return obj[0]
+    return obj
+
 def get_pbar(title, maxval):
     from yt.config import ytcfg
     from yt.logger import lagosLogger as mylog



More information about the yt-svn mailing list