[Python-ideas] Calling a function of a list without accumulating results

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Sep 27 04:46:36 CEST 2007

Terry Jones wrote:
> If list comprehensions are
> regarded as more pythonic and the Right Way to code in Python, I'd make the
> same argument for when you don't happen to want to keep the accumulated
> results.  Why force programmers to use two coding styles in order to get
> essentially the same thing done?

There isn't anything "more Pythonic" about the LC
syntax in itself. It's just a more compact alternative
for when you're constructing a list. It's not *un*-
Pythonic to *not* use it, even when you do want a
list. Nobody would fault you for not using one
when you could have.

The way things are, there is only one coding style
for when you don't want the results. You're suggesting
the addition of another one. That *would* be un-Pythonic.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | Carpe post meridiem!          	  |
Christchurch, New Zealand	   | (I'm not a morning person.)          |
greg.ewing at canterbury.ac.nz	   +--------------------------------------+

More information about the Python-ideas mailing list