[Python-Dev] Pre-PEP: Task-local variables

Guido van Rossum guido at python.org
Fri Oct 21 02:23:04 CEST 2005


On 10/20/05, Phillip J. Eby <pje at telecommunity.com> wrote:
> At 04:04 PM 10/20/2005 -0400, Jeremy Hylton wrote:
> >On 10/20/05, Guido van Rossum <guido at python.org> wrote:
> > > Whoa, folks! Can I ask the gentlemen to curb their enthusiasm?
> > >
> > > PEP 343 is still (back) on the drawing table, PEP 342 has barely been
> > > implemented (did it survive the AST-branch merge?), and already you
> > > are talking about adding more stuff. Please put on the brakes!
> >
> >Yes.  PEP 342 survived the merge of the AST branch.  I wonder, though,
> >if the Grammar for it can be simplified at all.  I haven't read the
> >PEP closely, but I found the changes a little hard to follow.  That
> >is, why was the grammar changed the way it was -- or how would you
> >describe the intent of the changes?
>
> The intent was to make it so that '(yield optional_expr)' always works, and
> also that   [lvalue =] yield optional_expr works.  If you can find another
> way to hack the grammar so that both of 'em work, it's certainly okay by
> me.  The changes I made were just the simplest things I could figure out to do.

Right.

> I seem to recall that the hard part was the need for 'yield expr,expr' to
> be interpreted as '(yield expr,expr)', not '(yield expr),expr', for
> backward compatibility reasons.

But only at the statement level.

These should be errors IMO:

  foo(yield expr, expr)
  foo(expr, yield expr)
  foo(1 + yield expr)
  x = yield expr, expr
  x = expr, yield expr
  x = 1 + yield expr

--
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list