Question about dir function
Tim Chase
python.list at tim.thechases.com
Sat Dec 19 19:45:33 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
>
>
So close, and yet thrown by requisite extra underscores:
>>> dir(_builtins_) # one _ before and after
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name '_builtins_' is not defined
>>> dir(__builtins__) # two _'s before and after
['ArithmeticError', 'AssertionError', 'AttributeError',
'BaseException', 'DeprecationWarning', 'EOFError', 'Ellipsis',
'EnvironmentError', 'Exception', 'False',...]
-tkc
More information about the Python-list
mailing list