[Chicago] Can you write Perl in Python?

Adrian Holovaty chipy at holovaty.com
Wed Dec 28 23:50:24 CET 2005


Ian Bicking wrote:
> List comprehension... I knew I was forgetting some entire language
> feature somewhere.

Maybe this helps somebody: I recently found out the space before the "for" in 
a list comprehension is not necessary if it's preceded by a close 
parenthesis. Only tested in Python 2.4.2.

For example, this is valid:
[str(i)for i in range(3)]

Character-saving-ly yours,
Adrian


More information about the Chicago mailing list