List comprehensions' ugliness (Was: Re: How to explain exactly what "def" does?)

Skip Montanaro skip at pobox.com
Wed Feb 5 14:38:27 EST 2003


    >> So, when exactly is a list comprehension ugly? I use them a lot in
    >> places where I used to use filter. For example:
    ...
    holger> To some of us the filter version reads much better.
    holger> It actually tells exactly what is happening: 
    holger> the 'foo' function filters out matching elements.

Doesn't it "filter in" matching elements?

At any rate, I'm beginning to think the reason most of these somewhat
controversial constructs have been added to the language is that the PSU
couldn't stand it that Python couldn't have the occasional indentation
flamefest, so they infected Gui





More information about the Python-list mailing list