[IPython-dev] Where should __future__ statements affect the interactive environment.
Wed Apr 25 15:50:01 CDT 2012
On Wed, Apr 25, 2012 at 12:56, Hans Meine <firstname.lastname@example.org> wrote:
> Am Dienstag, 24. April 2012, 00:04:31 schrieb Jörgen Stenarson:
> > To me it makes most sense to not import any __future__ into the global
> > namespace unless explicitly asked for by some option (like %run -i). In
> > short I would prefer to be explicit about what ends up globally.
> I felt exactly the same, namely that '%run foo.py' should behave similar to
> 'python foo.py' and *not* import the __future__s, while '%run -i foo.py' is
> more like execfile and should import them.
execfile does *not* bring in __future__ imports, but I agree with the idea.
I expect `run -i` to be
as close to interactive typing as we can get, but would be surprised if
regular `%run foo` included __future__ imports,
which are meant to be per-file.
> Even if -i is mostly used (AFAICS) for transferring bindings /into/ the
> context, it is actually documented as "run the file in IPython's namespace
> instead of an empty one", which would IMHO lead to the above semantics.
> Best regards,
> IPython-dev mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-dev