On Thursday 27 June 2002 01:29, Tim Peters wrote: > [Gerald S. Williams, on listcomp (non)scopes] > > > No problem. As long as it was decided that there's a use for > > the current behavior, I won't question it. > > I'm not sure there's a use for it, but I am sure I'd shoot any coworker > who found one and relied on it <wink>. 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) (I'm told Beretta makes excellent small arms, should you need one...). Alex
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