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/039122.html below:

[Python-Dev] Re: Re: accumulator display syntax

[Python-Dev] Re: Re: accumulator display syntax [Python-Dev] Re: Re: accumulator display syntaxGreg Ewing greg at cosc.canterbury.ac.nz
Tue Oct 21 03:27:03 EDT 2003
> >     sum([lazy x*x for x in sequence])
>
> I like this the best of suggestions so far.  Easy to understand, easy
> to teach:
> [lazy ...] = iter([...]) but produced more efficiently

-1. An iterator is not a lazy list. A lazy list would support
indexing, slicing, etc. while calculating its items on demand.
An iterator is inherently sequential and single-use -- a
different concept.

But maybe some other keyword could be added to ease any
syntactic problems, such as "all" or "every":

  sum(all x*x for x in xlist)
  sum(every x*x for x in xlist)

The presence of the extra keyword would then distinguish
an iterator comprehension from the innards of a list
comprehension.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+

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