Question about indentation and bugs

Martijn Faassen m.faassen at vet.uu.nl
Sat Aug 25 08:17:33 EDT 2001


Tim Peters <tim.one at home.com> wrote:
> [Terry Reedy]
>> *NOT* using {} redundantly for blocking frees {} for use as dictionary
>> delimiters.  Anyone who suggests using {} for structure should be
>> asked how they would write dictionary literals!

> Easy!  Instead of, e.g.,

[snip code sample]

> IOW, the body of a dict literal needs to be indented relative to the
> preceding stmt, and the stmt following a dict literal needs to be dedented.
> Apart from those rules, you can enjoy the readability afforded by curly
> braces to start stmts wherever the hell you feel like, damn it <wink>.

But this would conflict with a great new feature in Python 2.2, dict
comprehensions!

mydict = { x : str(y) for x, y in dict.items() if x > 10 }

Regards,

Martijn
-- 
History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?



More information about the Python-list mailing list