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/2003-October/039087.html below:

[Python-Dev] Re: accumulator display syntax

[Python-Dev] Re: accumulator display syntax [Python-Dev] Re: accumulator display syntaxGuido van Rossum guido at python.org
Mon Oct 20 14:15:22 EDT 2003
> Most of us seem to agree that having list comprehensions 
> available as a replacement for map() and filter() is a good
> thing. But what about reduce()? Are there equally strong
> reasons for wanting an alternative to that, too? If not,
> why not?

If anything, the desire there is *more* pressing.  Except for
operator.add, expressions involving reduce() are notoriously hard to
understand (except to experienced APL or Scheme hackers :-).

Things like sum, max, average etc. are expressed very elegantly with
iterator comprehensions.

I think the question is more one of frequency of use.  List comps have
nothing over e.g.

  result = []
  for x in S:
      result.append(x**2)

except compactness of exprssion.  How frequent is

  result = 0.0
  for x in S:
      result += x**2

???

(I've already said my -1 about your 'sum of ...' proposal.)

--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Python-Dev mailing list

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