Question about dir function
Matt Nordhoff
mnordhoff at mattnordhoff.com
Sat Dec 19 19:39:21 EST 2009
Ray Holt wrote:
> When I run a dir(_builtins_) I get the error message that the name
> _builtins_ is not defined. I haven't tried the dir function on other
> functions, but can someone tell me why I am getting this message?
> Thanks, Ray
You are getting that message because the name "_builtins_" is not
defined, as it says. You were probably looking for "__builtins__", with
2 underscores on each end, not just 1.
BTW, "__builtins__" is a CPython implementation detail. If you want to
play with built-in objects, you should import the __builtin__ (no "s")
module and use that.
--
Matt Nordhoff
More information about the Python-list
mailing list