[IPython-dev] Where should __future__ statements affect the interactive environment.
asmeurer at gmail.com
Mon Apr 23 14:41:39 EDT 2012
I thought %run was more like executing the script from the command
line. In other words, if you have
if __name__ == '__main__':
then blah will be run for %run (but it wouldn't in an import).
There are probably other invariants that hold in one situation but not
On Mon, Apr 23, 2012 at 4:44 AM, Fernando Perez <fperez.net at gmail.com> wrote:
> On Mon, Apr 23, 2012 at 3:25 AM, Thomas Kluyver <takowl at gmail.com> wrote:
>> On the other hand, %run (without -i) works a bit like doing `from foo
>> import *`, in which case you don't get semantic changes from
>> __future__ statements in foo. I'm inclined to agree with you that I'd
>> expect __future__ statements in %run to affect the interactive
>> environment, but I don't think it's entirely clear cut.
> I was thinking more about what the more natural workflow would be,
> since we pitch %run more closely related to "run a script as if you
> had typed all that interactively" than "a shorthand for 'import *'".
> But you are right, one could think of it either way...
> IPython-dev mailing list
> IPython-dev at scipy.org
More information about the IPython-dev