[Python-Dev] future and eval() (original) (raw)

Christian Tismer tismer at stackless.com
Sat Oct 1 07:39:45 EDT 2016


Hi guys,

when developing my dedent tool, I stumbled over the following behavior:

In dedent, I had the line

 from __future__ import print_function

Later in the script, I do some

 exec(the_script)

and I was surprised: The exec() script inherited the future statement! It behaved like the future statement were implicitly there.

Is that a bug or a feature?

You can try the effect by "pip install dedent" and adding the future statement there.

I'd like to know if this is a bug (and I think so)

-- Christian Tismer :^) tismer at stackless.com Software Consulting : http://www.stackless.com/ Karl-Liebknecht-Str. 121 : https://github.com/PySide 14482 Potsdam : GPG key -> 0xFB7BEE0E phone +49 173 24 18 776 fax +49 (30) 700143-0023



More information about the Python-Dev mailing list