On 25 Mar 2009, at 21:29 , Stef Mientki wrote:

Now it would be nice to allow iteration over others too, like None .
   a = None
   for item in a :
         do_something_with_item


I saw this technique used in CherryPy:

>>> a=None
>>> for item in a or []:
...    print item
...
>>> a=[1,2,3]
>>> for item in a or []:
...     print item
...
1
2
3
>>>



--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to