PEP 255: Simple Generators

Kalle Svensson kalle at gnupung.net
Fri Jun 22 10:59:57 EDT 2001


Sez David Goodger:
> Generators are very cool. I'm sure I will use them. I'm glad they're getting
> into Python. Thank you Neil, Tim, and Magnus, for all your work.

+1

> on 2001-06-21 2:57 PM, Tim Peters (tim at digicool.com) wrote:
> > a generator-function returns a generator-iterator
> 
> That's what it boils down to. Before generators, all functions returned
> objects using explicit 'return' statements. Now, generator-functions return
> generator-iterators, but there's *nothing* explicitly saying 'return
> generator_iterator'. Before generators, calling a function executed its
> code. Now, calling a generator-function doesn't execute the code at all; you
> have to execute the magically returned object. Only the 'yield' indicates
> any of this variant behavior.
> 
> Can I get used to it? Yes, I think I have enough spare brain cells. (Heck, I
> used to know Perl! ;-)
> 
> Should I get used to it?
> 
> "Explicit is better than implicit."

Well put!  I've had a nagging feeling that PEP 255 was not all nice, and
this expresses my concerns very clearly.

Peace,
  Kalle
-- 
Email: kalle at gnupung.net     | You can tune a filesystem, but you
Web: http://www.gnupung.net/ | can't tune a fish. -- man tunefs(8)
PGP fingerprint: 0C56 B171 8159 327F 1824 F5DE 74D7 80D7 BF3B B1DD
 [ Not signed due to lossage.  Blame Microsoft Outlook Express. ]




More information about the Python-list mailing list