__builtins__

Fred L. Drake, Jr. fdrake at acm.org
Tue May 30 20:47:41 EDT 2000


Huaiyu Zhu writes:
 > It looks like that I have to use
 > 	__builtins__.min (1,2)
 > 
 > in the interpreter but
 > 	__builtins__['min']([1, 2])
 > 
 > in a module.  Why is this so?
 > 
 > This arises in the context of redefining min in a module.

Try:

	import __builtin__    # no 's'
        __builtin__.min(...)

  This will work in both contexts.  __builtins__ (with the 's') is an
implementation detail and need not be used in source code.


  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at acm.org>





More information about the Python-list mailing list