A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-July/026179.html below:

[Python-Dev] List comprehensions

[Python-Dev] List comprehensionsTim Peters tim.one@comcast.net
Fri, 05 Jul 2002 13:48:11 -0400
[Alex Martelli]
> The real (and no doubt PSU-intended) use of list comprehensions is, of
> course, to finesse Python's _apparent_ lack of assignment-in-expression.
>
> Instead of coding a vulgar, typo-prone, hoi-polloi oriented:
>     while x = bluh():
>         whatever(x)
> you get to code an elegant, refined, hoi-oligoi reserved:
>     while [ x for x in [bluh()] if x ] :
>         whatever(x)

Excellent!  Guido uses

    while [x for x in [bluh()]][0]:
        whatever(x)

because he thinks it's "more elegant" (whatever that means to a Dutch guy),
but either way it's major relief from the obscurity of embedded assignment.

> (I'm told Beretta makes excellent small arms, should you need one...).

Thanks for the suggestion!  Some Americans consider it rude to shoot
coworkers, so I'm always looking for ways to get across to them that it's
more a matter of defending good taste than of killing people.  Using a piece
with sleek Italian design should go a long way toward helping to make this
point.





RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4