I am coding python in emacs. However, somehow the python interpreter running in emacs amazes me.
If i write
print() print(__name__) print(__name__=='__main__') if __name__ == '__main__': print("indeed")
in emacs buffer and tell emacs to start the interpreter and run the contents of this buffer, I get a buffer containing
Python 3.3.5 (default, Mar 18 2014, 02:00:02) [GCC 4.2.1 20070831 patched [FreeBSD]] on freebsd9 Type "help", "copyright", "credits" or "license" for more information. >>> __main__ True >>>
(Both __main__ and True are outputs from the print statement, the python buffer always displays >>> and prints right after it. I know that, this is not a problem.)
From the command line, both python and python -i show "really" as expected.
How is Emacs capable of inconsistencies in evaluating __name__=='__main__' to True , but doesn't do things inside if __name__ == '__main__': :? And how to reconfigure it so that it no longer does this?
python emacs
Anaphory
source share