Scott David Daniels wrote: > Roberto Bonvallet wrote: >> imho <[EMAIL PROTECTED]>: >>> map(lambda x:"" , [i for i in [a,b,c] if i in ("None",None) ]) >> You don't need map when using list comprehensions: >> ["" for i in [a, b, c] if i in ("None", None)] >> > More like: > > [(i, "")[i in ("None", None)] for i in [a,b,c]]
Or in Python 2.5: Python 2.5a2 (trunk:46491M, May 27 2006, 14:43:55) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> a = 0 >>> b = None >>> c = None >>> a, b, c = ('' if x in (None, 'None') else x for x in (a, b, c)) >>> a, b, c (0, '', '') But someone please shoot me if I ever use something like that in production code. ;) STeVe -- http://mail.python.org/mailman/listinfo/python-list