Python Global Constant

Terry Reedy tjreedy at udel.edu
Wed Jul 9 13:59:40 EDT 2003


> What about using __builtins__ wouldn't make this the constant really
global?

Short respone: this is an implementation-detail-dependent hack that
Guido discourges and that Guido would be willing to break if there
were sufficient gain otherwise.

Longer answer: I once though of doing this too.  However, the language
reference specifies  module import as the means to make objects
globally accessible.  I don't believe that the language reference
specifies the implementation details for the builtins namespace.
While currently
implemented as a user-writeble dict of the {} type, bound to the name
__builtins__, this could change.

Terry J. Reedy






More information about the Python-list mailing list