Difficulty with `cmp', still

Fred L. Drake, Jr. fdrake at acm.org
Wed Sep 22 11:03:46 EDT 1999


François Pinard writes:
 > So, it is a dictionary in batch, and a module interactively?  This looks
 > rather strange.  It does not fit well within Python's usual simplicity.

François,
  __builtins__ is a module in __main__ regardless of interactivity,
and a dictionary elsewhere.  This is primarily to avoid excessively
long reprs from things like "globals()" typed at the interactive
prompt.  The interactive prompt operates in the __main__ module:

	>>> import __main__
        >>> globals() is __main__.__dict__
        1

  I'm glad you're having fun with Python!


  -Fred

--
Fred L. Drake, Jr.	     <fdrake at acm.org>
Corporation for National Research Initiatives




More information about the Python-list mailing list