[IPython-dev] Where should __future__ statements affect the interactive environment.

MinRK benjaminrk at gmail.com
Wed Apr 25 16:50:01 EDT 2012


On Wed, Apr 25, 2012 at 12:56, Hans Meine <hans_meine at gmx.net> 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
> script
> 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,
>  Hans
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20120425/ccf966aa/attachment.html>


More information about the IPython-dev mailing list