Kaydet (Commit) 4a42ec50 authored tarafından Ezio Melotti's avatar Ezio Melotti

Merge updates about dir() with 3.2.

...@@ -288,17 +288,25 @@ defines. It returns a sorted list of strings:: ...@@ -288,17 +288,25 @@ defines. It returns a sorted list of strings::
>>> import fibo, sys >>> import fibo, sys
>>> dir(fibo) >>> dir(fibo)
['__name__', 'fib', 'fib2'] ['__name__', 'fib', 'fib2']
>>> dir(sys) >>> dir(sys) # doctest: +NORMALIZE_WHITESPACE
['__displayhook__', '__doc__', '__excepthook__', '__name__', '__stderr__', ['__displayhook__', '__doc__', '__egginsert', '__excepthook__',
'__stdin__', '__stdout__', '_getframe', 'api_version', 'argv', '__loader__', '__name__', '__package__', '__plen', '__stderr__',
'builtin_module_names', 'byteorder', 'callstats', 'copyright', '__stdin__', '__stdout__', '_clear_type_cache', '_current_frames',
'displayhook', 'exc_info', 'excepthook', '_debugmallocstats', '_getframe', '_home', '_mercurial', '_xoptions',
'exec_prefix', 'executable', 'exit', 'getdefaultencoding', 'getdlopenflags', 'abiflags', 'api_version', 'argv', 'base_exec_prefix', 'base_prefix',
'getrecursionlimit', 'getrefcount', 'hexversion', 'maxint', 'maxunicode', 'builtin_module_names', 'byteorder', 'call_tracing', 'callstats',
'copyright', 'displayhook', 'dont_write_bytecode', 'exc_info',
'excepthook', 'exec_prefix', 'executable', 'exit', 'flags', 'float_info',
'float_repr_style', 'getcheckinterval', 'getdefaultencoding',
'getdlopenflags', 'getfilesystemencoding', 'getobjects', 'getprofile',
'getrecursionlimit', 'getrefcount', 'getsizeof', 'getswitchinterval',
'gettotalrefcount', 'gettrace', 'hash_info', 'hexversion',
'implementation', 'int_info', 'intern', 'maxsize', 'maxunicode',
'meta_path', 'modules', 'path', 'path_hooks', 'path_importer_cache', 'meta_path', 'modules', 'path', 'path_hooks', 'path_importer_cache',
'platform', 'prefix', 'ps1', 'ps2', 'setcheckinterval', 'setdlopenflags', 'platform', 'prefix', 'ps1', 'setcheckinterval', 'setdlopenflags',
'setprofile', 'setrecursionlimit', 'settrace', 'stderr', 'stdin', 'stdout', 'setprofile', 'setrecursionlimit', 'setswitchinterval', 'settrace',
'version', 'version_info', 'warnoptions'] 'stderr', 'stdin', 'stdout', 'thread_info', 'version', 'version_info',
'warnoptions']
Without arguments, :func:`dir` lists the names you have defined currently:: Without arguments, :func:`dir` lists the names you have defined currently::
...@@ -306,7 +314,7 @@ Without arguments, :func:`dir` lists the names you have defined currently:: ...@@ -306,7 +314,7 @@ Without arguments, :func:`dir` lists the names you have defined currently::
>>> import fibo >>> import fibo
>>> fib = fibo.fib >>> fib = fibo.fib
>>> dir() >>> dir()
['__builtins__', '__doc__', '__file__', '__name__', 'a', 'fib', 'fibo', 'sys'] ['__builtins__', '__name__', 'a', 'fib', 'fibo', 'sys']
Note that it lists all types of names: variables, modules, functions, etc. Note that it lists all types of names: variables, modules, functions, etc.
...@@ -317,28 +325,36 @@ want a list of those, they are defined in the standard module ...@@ -317,28 +325,36 @@ want a list of those, they are defined in the standard module
:mod:`builtins`:: :mod:`builtins`::
>>> import builtins >>> import builtins
>>> dir(builtins) >>> dir(builtins) # doctest: +NORMALIZE_WHITESPACE
['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException',
['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException', 'Buffer 'BlockingIOError', 'BrokenPipeError', 'BufferError', 'BytesWarning',
Error', 'BytesWarning', 'DeprecationWarning', 'EOFError', 'Ellipsis', 'Environme 'ChildProcessError', 'ConnectionAbortedError', 'ConnectionError',
ntError', 'Exception', 'False', 'FloatingPointError', 'FutureWarning', 'Generato 'ConnectionRefusedError', 'ConnectionResetError', 'DeprecationWarning',
rExit', 'IOError', 'ImportError', 'ImportWarning', 'IndentationError', 'IndexErr 'EOFError', 'Ellipsis', 'EnvironmentError', 'Exception', 'False',
or', 'KeyError', 'KeyboardInterrupt', 'LookupError', 'MemoryError', 'NameError', 'FileExistsError', 'FileNotFoundError', 'FloatingPointError',
'None', 'NotImplemented', 'NotImplementedError', 'OSError', 'OverflowError', 'P 'FutureWarning', 'GeneratorExit', 'IOError', 'ImportError',
endingDeprecationWarning', 'ReferenceError', 'RuntimeError', 'RuntimeWarning', ' 'ImportWarning', 'IndentationError', 'IndexError', 'InterruptedError',
StopIteration', 'SyntaxError', 'SyntaxWarning', 'SystemError', 'SystemExit', 'Ta 'IsADirectoryError', 'KeyError', 'KeyboardInterrupt', 'LookupError',
bError', 'True', 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError', 'Unicod 'MemoryError', 'NameError', 'None', 'NotADirectoryError', 'NotImplemented',
eEncodeError', 'UnicodeError', 'UnicodeTranslateError', 'UnicodeWarning', 'UserW 'NotImplementedError', 'OSError', 'OverflowError',
arning', 'ValueError', 'Warning', 'ZeroDivisionError', '__build_class__', '__deb 'PendingDeprecationWarning', 'PermissionError', 'ProcessLookupError',
ug__', '__doc__', '__import__', '__name__', '__package__', 'abs', 'all', 'any', 'ReferenceError', 'ResourceWarning', 'RuntimeError', 'RuntimeWarning',
'ascii', 'bin', 'bool', 'bytearray', 'bytes', 'chr', 'classmethod', 'compile', ' 'StopIteration', 'SyntaxError', 'SyntaxWarning', 'SystemError',
complex', 'copyright', 'credits', 'delattr', 'dict', 'dir', 'divmod', 'enumerate 'SystemExit', 'TabError', 'TimeoutError', 'True', 'TypeError',
', 'eval', 'exec', 'exit', 'filter', 'float', 'format', 'frozenset', 'getattr', 'UnboundLocalError', 'UnicodeDecodeError', 'UnicodeEncodeError',
'globals', 'hasattr', 'hash', 'help', 'hex', 'id', 'input', 'int', 'isinstance', 'UnicodeError', 'UnicodeTranslateError', 'UnicodeWarning', 'UserWarning',
'issubclass', 'iter', 'len', 'license', 'list', 'locals', 'map', 'max', 'memory 'ValueError', 'Warning', 'ZeroDivisionError', '_', '__build_class__',
view', 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'print', 'property' '__debug__', '__doc__', '__import__', '__name__', '__package__', 'abs',
, 'quit', 'range', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice', 'sort 'all', 'any', 'ascii', 'bin', 'bool', 'bytearray', 'bytes', 'callable',
ed', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'vars', 'zip'] 'chr', 'classmethod', 'compile', 'complex', 'copyright', 'credits',
'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'exec', 'exit',
'filter', 'float', 'format', 'frozenset', 'getattr', 'globals', 'hasattr',
'hash', 'help', 'hex', 'id', 'input', 'int', 'isinstance', 'issubclass',
'iter', 'len', 'license', 'list', 'locals', 'map', 'max', 'memoryview',
'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'print', 'property',
'quit', 'range', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice',
'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'vars',
'zip']
.. _tut-packages: .. _tut-packages:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment