[IPython-User] Please stop faking __main__ module
Ken Hori
fplemma@gmail....
Sat Nov 20 17:31:49 CST 2010
I'm fairly new to ipython. While I was playing around with ipython, I found a
clear difference (which in my opinion is a bug) b/w 'python -i' and ipython:
$ python -i
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> a = 'foo'
>>> import __main__; print '%s: %s' % (__main__, __main__.a)
<module '__main__' (built-in)>: foo
$ ipython
>>> a = 'foo'
>>> import __main__; print '%s: %s' % (__main__, __main__.a)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/home/unko/<ipython console> in <module>()
AttributeError: 'FakeModule' object has no attribute 'a'
A web search shows that __main__ took a form of the FakeModule due to some
"bizarre pickling/unpickling failures" in ipython, but I'm not sure if the bug
is worth breaking the convention followed by the python interpreter in
general. It is rather ugly.
What are those "bizarre pickling/unpickling failures"? Regardless, why not just
stop faking __main__ module and fix those failures in the first place?
Thanks.
More information about the IPython-User
mailing list