while (assignment):

Delaney, Timothy C (Timothy) tdelaney at avaya.com
Wed Jul 30 01:03:56 EDT 2003


> From: Andrew Dalke [mailto:adalke at mindspring.com]
> 
> >>> a = [1, 2, 9, 0]
> >>> n = iter(a).next
> >>> while [x for x in [n()] if x]:
> ...  print "I have", x
> ...
> I have 1
> I have 2
> I have 9
> >>>
> 
> Again, don't this in real code.  Evil.  But cute.

I would say it's actually rude, rather than evil.

Tim Delaney





More information about the Python-list mailing list