palo wrote:
> ... what would you think about this:
> as a substitute for filter, people often use
> [x for x in y if z(x)]
> The suggestion is that the same result could be achieved by
> [x in y if z(x)]
In the original syntax, if z(x) is always true,
you can leave the "if z(x)" part away, wh
you'd save more in
[not_very_convenient_name for not_very_convenient_name in y if z]
(just kidding)
--
http://mail.python.org/mailman/listinfo/python-list
you'd save more characters in
[not_very_convenient_name for not_very_convenient_name in y if z]
(just kidding)
--
http://mail.python.org/mailman/listinfo/python-list
palo on comp.lang.python said:
> The suggestion is that the same result could be achieved by
> [x in y if z(x)]
It's just a special case... and it saves very few carachters... I don't
think it would justify an update to the parser. What if you want to do
something like:
[str(x) for x in y if z(
I appologize for suggesting (though very humbly) a syntax extension
(maybe particularly idiotic) but just as a wild fantasy, what would you
think about this:
as a substitute for filter, people often use
[x for x in y if z(x)]
The suggestion is that the same result could be achieved by
[x in y if z(