[Python-Dev] Okay to document the "exec tuple" form of the exec statement in Python 2.7?

Guido van Rossum guido at python.org
Mon Nov 5 15:57:30 CET 2012


+1. This probably fell through the cracks because I changed my mind on
this. The function form was old, and I wanted to root it out in favor fo
the statement. But then I changed my mind for py3k. Good idea to document
and add tests in 2.x.

--Guido

On Monday, November 5, 2012, Nick Coghlan wrote:

> On Mon, Nov 5, 2012 at 10:08 PM, Mark Dickinson <dickinsm at gmail.com<javascript:;>>
> wrote:
> > In Python 2, the 'exec' statement supports 'exec'-ing a (statement,
> > globals, locals) tuple:
> >
> >>>> exec("print 2", {}, {})
> > 2
> >
> > This isn't currently documented at:
> > http://docs.python.org/reference/simple_stmts.html#the-exec-statement.
> >  It's easy to fix the docs, but in doing so we'd effectively be
> > blessing this form of exec as an official part of the language.  Do
> > people think it's acceptable to add this to the docs, or are there
> > good reasons for the 'exec tuple' form of the exec statement to remain
> > an undocumented feature?
> >
> > See also http://bugs.python.org/issue16339.
>
> If you can find an existing test for it, then definitely (although the
> fact it didn't previously work on Jython suggests there may not be
> one).
>
> If there's no test, then I'd still be in favour of making it official
> both by testing *and* documenting it, for the forward compatibility
> benefits you mention on the tracker.
>
> Cheers,
> Nick.
>
> --
> Nick Coghlan   |   ncoghlan at gmail.com <javascript:;>   |   Brisbane,
> Australia
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org <javascript:;>
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> http://mail.python.org/mailman/options/python-dev/guido%40python.org
>


-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20121105/901ba3dd/attachment.html>


More information about the Python-Dev mailing list