[Python-ideas] filter-only list comps

Georg Brandl g.brandl at gmx.net
Fri Feb 26 22:32:02 CET 2010


Am 26.02.2010 17:09, schrieb Boris Borcic:
> Stefan Behnel wrote:
>> Stephen J. Turnbull, 26.02.2010 04:28:
>>> Greg Ewing writes:
>>>
>>>   >     [x from stuff]
>>>   >
>>>   >  is a shorthand for
>>>   >
>>>   >     [x for x in stuff]
>>>
>>> Any time you say "shorthand" you're probably violating TOOWTDI. :-)
>>
>> Absolutely, so I would expect this to have zero change to make it in.
> 
> Now that's quite a pun, or more exactly quite an à peu près. Of course if 
> TOOWTDI runs, it gets characteristic of any change that TOOWTDI is violated, eg, 
> the one old way, the one new way.

Not really -- remember that there is "obvious" in the acronym.  We should
strive to make such changes that don't violate it.  For example, the "with"
statement introduced the obvious way to handle resources.  The "if-else"
expression introduced the obvious way to express conditionals. Etc.

Georg

-- 
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.




More information about the Python-ideas mailing list