[Python-Dev] from future import yield

Martin von Loewis loewis@informatik.hu-berlin.de
Sat, 7 Jul 2001 20:38:35 +0200 (MEST)

> Regarding the yield statement: I'd love to require a future statement,
> but the current support for future statements doesn't support
> modifying the parser based on the presence of future statements, and I
> don't know how to resolve that, short of totally rewriting the parser
> or scanning ahead looking for a future statement with some regular
> expression.

The "directive" patch manages to conditionally introduce a new keyword,
namely directive. The trick is to introduce it into the grammar, but only
recognize it as a keyword if a flag is set. That approach could
be used for future imports also, although I'd much prefer to spell it

directive transitional yield