[Python-ideas] filter-only list comps
spir
denis.spir at gmail.com
Sat Feb 27 13:31:25 CET 2010
On Fri, 26 Feb 2010 22:32:02 +0100
Georg Brandl <g.brandl at gmx.net> wrote:
> > 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.
From that point of view, I guess the obvious way to express the absence of a mapping should not be the expression of an identity mapping (in the sense of the math identity function) ;-)
(for) item in collection vs item for item in collection
In the same way that we don't express the absence of a filter using a True filter:
expr for item in collection vs expr for item in collection if True
But sure, again, the ambiguity of "in" seems to be an obstacle for python to adopt the obvious way.
Denis
--
________________________________
la vita e estrany
spir.wikidot.com
More information about the Python-ideas
mailing list