idiom for list looping

MRAB python at mrabarnett.plus.com
Wed Jul 29 07:17:14 EDT 2009


Xavier Ho wrote:
> On Wed, Jul 29, 2009 at 8:52 PM, MRAB <python at mrabarnett.plus.com 
> <mailto:python at mrabarnett.plus.com>> wrote:
> 
>     Slightly shorter:
> 
>     print '\n'.join("%s - %s" % p for p in enumerate(nomi))
> 
>     :-)
> 
> That's cool. Does that make the "list" a tuple? (not that it matters, 
> I'm just curious!)
> 
I've just replaced the list comprehension with a generator expression.




More information about the Python-list mailing list