@@ -288,16 +288,21 @@ defines. It returns a sorted list of strings::
288288 >>> import fibo, sys
289289 >>> dir(fibo)
290290 ['__name__', 'fib', 'fib2']
291- >>> dir(sys)
292- ['__displayhook__', '__doc__', '__excepthook__', '__name__', '__stderr__',
293- '__stdin__', '__stdout__', '_getframe', 'api_version', 'argv',
294- 'builtin_module_names', 'byteorder', 'callstats', 'copyright',
295- 'displayhook', 'exc_info', 'excepthook',
296- 'exec_prefix', 'executable', 'exit', 'getdefaultencoding', 'getdlopenflags',
297- 'getrecursionlimit', 'getrefcount', 'hexversion', 'maxint', 'maxunicode',
298- 'meta_path', 'modules', 'path', 'path_hooks', 'path_importer_cache',
299- 'platform', 'prefix', 'ps1', 'ps2', 'setcheckinterval', 'setdlopenflags',
300- 'setprofile', 'setrecursionlimit', 'settrace', 'stderr', 'stdin', 'stdout',
291+ >>> dir(sys) # doctest: +NORMALIZE_WHITESPACE
292+ ['__displayhook__', '__doc__', '__excepthook__', '__name__', '__package__',
293+ '__stderr__', '__stdin__', '__stdout__', '_clear_type_cache',
294+ '_current_frames', '_getframe', '_mercurial', '_xoptions', 'abiflags',
295+ 'api_version', 'argv', 'builtin_module_names', 'byteorder', 'call_tracing',
296+ 'callstats', 'copyright', 'displayhook', 'dont_write_bytecode', 'exc_info',
297+ 'excepthook', 'exec_prefix', 'executable', 'exit', 'flags', 'float_info',
298+ 'float_repr_style', 'getcheckinterval', 'getdefaultencoding',
299+ 'getdlopenflags', 'getfilesystemencoding', 'getobjects', 'getprofile',
300+ 'getrecursionlimit', 'getrefcount', 'getsizeof', 'getswitchinterval',
301+ 'gettotalrefcount', 'gettrace', 'hash_info', 'hexversion', 'int_info',
302+ 'intern', 'maxsize', 'maxunicode', 'meta_path', 'modules', 'path',
303+ 'path_hooks', 'path_importer_cache', 'platform', 'prefix', 'ps1',
304+ 'setcheckinterval', 'setdlopenflags', 'setprofile', 'setrecursionlimit',
305+ 'setswitchinterval', 'settrace', 'stderr', 'stdin', 'stdout', 'subversion',
301306 'version', 'version_info', 'warnoptions']
302307
303308Without arguments, :func: `dir ` lists the names you have defined currently::
@@ -306,7 +311,7 @@ Without arguments, :func:`dir` lists the names you have defined currently::
306311 >>> import fibo
307312 >>> fib = fibo.fib
308313 >>> dir()
309- ['__builtins__', '__doc__', '__file__', ' __name__', 'a', 'fib', 'fibo', 'sys']
314+ ['__builtins__', '__name__', 'a', 'fib', 'fibo', 'sys']
310315
311316Note that it lists all types of names: variables, modules, functions, etc.
312317
@@ -317,28 +322,31 @@ want a list of those, they are defined in the standard module
317322:mod: `builtins `::
318323
319324 >>> import builtins
320- >>> dir(builtins)
321-
322- ['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException', 'Buffer
323- Error', 'BytesWarning', 'DeprecationWarning', 'EOFError', 'Ellipsis', 'Environme
324- ntError', 'Exception', 'False', 'FloatingPointError', 'FutureWarning', 'Generato
325- rExit', 'IOError', 'ImportError', 'ImportWarning', 'IndentationError', 'IndexErr
326- or', 'KeyError', 'KeyboardInterrupt', 'LookupError', 'MemoryError', 'NameError',
327- 'None', 'NotImplemented', 'NotImplementedError', 'OSError', 'OverflowError', 'P
328- endingDeprecationWarning', 'ReferenceError', 'RuntimeError', 'RuntimeWarning', '
329- StopIteration', 'SyntaxError', 'SyntaxWarning', 'SystemError', 'SystemExit', 'Ta
330- bError', 'True', 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError', 'Unicod
331- eEncodeError', 'UnicodeError', 'UnicodeTranslateError', 'UnicodeWarning', 'UserW
332- arning', 'ValueError', 'Warning', 'ZeroDivisionError', '__build_class__', '__deb
333- ug__', '__doc__', '__import__', '__name__', '__package__', 'abs', 'all', 'any',
334- 'ascii', 'bin', 'bool', 'bytearray', 'bytes', 'chr', 'classmethod', 'compile', '
335- complex', 'copyright', 'credits', 'delattr', 'dict', 'dir', 'divmod', 'enumerate
336- ', 'eval', 'exec', 'exit', 'filter', 'float', 'format', 'frozenset', 'getattr',
337- 'globals', 'hasattr', 'hash', 'help', 'hex', 'id', 'input', 'int', 'isinstance',
338- 'issubclass', 'iter', 'len', 'license', 'list', 'locals', 'map', 'max', 'memory
339- view', 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'print', 'property'
340- , 'quit', 'range', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice', 'sort
341- ed', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'vars', 'zip']
325+ >>> dir(builtins) # doctest: +NORMALIZE_WHITESPACE
326+ ['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException',
327+ 'BufferError', 'BytesWarning', 'DeprecationWarning', 'EOFError',
328+ 'Ellipsis', 'EnvironmentError', 'Exception', 'False', 'FloatingPointError',
329+ 'FutureWarning', 'GeneratorExit', 'IOError', 'ImportError',
330+ 'ImportWarning', 'IndentationError', 'IndexError', 'KeyError',
331+ 'KeyboardInterrupt', 'LookupError', 'MemoryError', 'NameError', 'None',
332+ 'NotImplemented', 'NotImplementedError', 'OSError', 'OverflowError',
333+ 'PendingDeprecationWarning', 'ReferenceError', 'ResourceWarning',
334+ 'RuntimeError', 'RuntimeWarning', 'StopIteration', 'SyntaxError',
335+ 'SyntaxWarning', 'SystemError', 'SystemExit', 'TabError', 'True',
336+ 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError',
337+ 'UnicodeEncodeError', 'UnicodeError', 'UnicodeTranslateError',
338+ 'UnicodeWarning', 'UserWarning', 'ValueError', 'Warning',
339+ 'ZeroDivisionError', '_', '__build_class__', '__debug__', '__doc__',
340+ '__import__', '__name__', '__package__', 'abs', 'all', 'any', 'ascii',
341+ 'bin', 'bool', 'bytearray', 'bytes', 'callable', 'chr', 'classmethod',
342+ 'compile', 'complex', 'copyright', 'credits', 'delattr', 'dict', 'dir',
343+ 'divmod', 'enumerate', 'eval', 'exec', 'exit', 'filter', 'float', 'format',
344+ 'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex', 'id',
345+ 'input', 'int', 'isinstance', 'issubclass', 'iter', 'len', 'license',
346+ 'list', 'locals', 'map', 'max', 'memoryview', 'min', 'next', 'object',
347+ 'oct', 'open', 'ord', 'pow', 'print', 'property', 'quit', 'range', 'repr',
348+ 'reversed', 'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod',
349+ 'str', 'sum', 'super', 'tuple', 'type', 'vars', 'zip']
342350
343351.. _tut-packages :
344352
0 commit comments