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

[Python-Dev] accumulator display syntax

[Python-Dev] accumulator display syntaxSkip Montanaro skip at pobox.com
Fri Oct 17 16:20:38 EDT 2003
    >> Is it supposed to return a generator function which I can assign to a
    >> variable (or pass to the builtin function sum() as in your example)
    >> and call later, or is it supposed to turn the current function into a
    >> generator function (so that each executed yield statement returns a
    >> value to the caller of the current function)?

    Alex> Neither: it returns an iterator, _equivalent_ to the one that
    Alex> would be returned by _calling_ a generator such as

    Alex> def xxx():
    Alex>     for x in S:
    Alex>         yield x

All the more reason not to like this.  Why not just define the generator
function and call it?

While Perl sprouts magical punctuation, turning its syntax into line noise,
Python seems to be sprouting multiple function-like things.  We have 

    * functions
    * unbound methods
    * bound methods
    * generator functions
    * iterators (currently invisible via syntax, but created by calling a
      generator function?)
    * instances magically callable via __call__

and now this new (rather limited) syntax for creating iterators.

I am beginning to find it all a bit confusing and unsettling.

Skip

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