A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2002-November/030392.html below:

[Python-Dev] PEP 288: Generator Attributes

[Python-Dev] PEP 288: Generator Attributes [Python-Dev] PEP 288: Generator AttributesTim Peters tim.one@comcast.net
Sat, 23 Nov 2002 23:48:12 -0500
[Jack Jansen]
> I don't like it, there's "Magic! Magic!" written all over it.
> Generators have always given me that feeling (you start reading them as
> a function, then 20 lines down you meet a "yield" and suddenly realize
> you have to start reading at the top again, keeping in mind that this
> is a persistent stack frame),

Except you don't need to do such a thing -- "yield" is much the same as
"print" this way.  Both have the same effect on the stack frame:  none.  So
if you don't find print to be confusing wrt local state, you shouldn't find
yield confusing wrt local state either.

> ...
> Generators have to me always felt more "class-instance-like" than
> "function-like",

I *exoect* you'll feel more the opposite the more you use them.  Heck,
they're so much like functions that Guido reused "def" for them <wink>.




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