This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: It's the future for generators
Type: Stage:
Components: Interpreter Core Versions: Python 2.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: tim.peters Nosy List: gvanrossum, nascheme, rhettinger, tim.peters
Priority: normal Keywords:

Created on 2001-12-21 22:17 by tim.peters, last changed 2022-04-10 16:04 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
undo_yield_hack.diff nascheme, 2002-03-22 20:04
Messages (10)
msg8431 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2001-12-21 22:17
"from __future__ import generators" should no longer 
be required in 2.3a1.  Such stmts should also be 
removed from the Python library (there's a script 
under Tools to automate this).
msg8432 - (view) Author: Neil Schemenauer (nascheme) * (Python committer) Date: 2002-03-22 20:04
Logged In: YES 
user_id=35752

The attached patch removes the "yield is an optional keyword"
hacks from the parser.  It's not a complete fix for this
bug though.
msg8433 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2002-03-22 20:34
Logged In: YES 
user_id=31435

Neil, if you don't enjoy using the patch system for 
straightforward stuff like this, don't feel compelled to 
use it.  That is, just check it in.
msg8434 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-03-22 21:13
Logged In: YES 
user_id=6380

There ought to be documentation on what to do when an
optional feature becomes mandatory. Maybe a block comment or
docstring in __future__.py?
msg8435 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2002-03-22 21:22
Logged In: YES 
user_id=31435

The internal future machinery has changed every time we've 
added a new future gimmick.  So there's really nothing to 
be said other than to scour the source code looking for now-
obsolete "stuff".  For example, it's possible that the 
kinds of parser changes made for "yield" will never happen 
again, and, even if they do, I think it's impossible to 
predict where and how the parser will need to be unchanged.
msg8436 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-03-22 21:39
Logged In: YES 
user_id=6380

Actually, each time a future feature introduces a new
keyword that has to remain an identifier when the feature is
not enabled, almost *exactly* the same hacks have to be
applied to the parser. That's just how the parser works. I
would almost recommend keeping those changes around at all
times, just #ifdef'ed out or something.

The other stuff that feels like it's very similar each time
is the handling of the flags passed around between the
various passes of the code generator.

But I know it's hopeless to argue with you, so I'll let you
rediscover all that when you decide to finally implement the
braces feature. :-)
msg8437 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2002-03-22 21:59
Logged In: YES 
user_id=31435

Na, you should read me as saying I don't know how to write 
the kinds of docs you want.  I didn't do the parser changes 
here, so if you think there's something predictable and 
useful to be said here, you're the one to say it.

Keeping at least one example around under an "#if 0" sounds 
like an excellent idea.  The last time I implemented a 
future gimmick, it was spread around in so many places that 
the only sane way to proceed was to search for "the other" 
future gimmick that happened to be implemented already.

But doing that kind of search again is the only sane way I 
know to get rid of the future-generator business now too.
msg8438 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-03-22 22:18
Logged In: YES 
user_id=6380

It's not too late!  Neil hasn't checked it in yet.

Neil, would you be willing to change your patch so that it
disables the yield keyword using #ifdef rather than by
erasing all of the code?
msg8439 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2002-06-20 07:59
Logged In: YES 
user_id=80475

Can this be closed?
The library is free of from __future__ generators and the 
core doesn't require it now.
msg8440 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2002-06-20 14:54
Logged In: YES 
user_id=31435

Thanks for the reminder!  There was still a generator future 
stmt in test_enumerate.py, which I just got rid of.  I don't 
know of any other glitches here, so finally closing this.
History
Date User Action Args
2022-04-10 16:04:49adminsetgithub: 35814
2001-12-21 22:17:39tim.peterscreate