[Python-Dev] Not documented special methods

Serhiy Storchaka storchaka at gmail.com
Wed Mar 11 12:25:39 CET 2015


There are many special names used in Python core and the stdlib, but 
absent in the documentation index [1]. If you see names that are defined 
or used in the module or area maintained by you, please add references 
to these names to the index and document them if it is needed.

Repeat the lists here.

Module level names used in pydoc:
     __author__
     __credits__
     __date__
     __version__

Module level name used in doctest:
     __test__

Other module level names:
     __about__               (heapq only)
     __copyright__           (many modules)
     __cvsid__               (tarfile only)
     __docformat__           (doctest only)
     __email__               (test_with and test_keywordonlyarg only)
     __libmpdec_version__    (decimal only)
     __status__              (logging only)


type attributes (mostly used in tests):
     __abstractmethods__     (used in abc, functools)
     __base__
     __basicsize__
     __dictoffset__
     __flags__               (used in inspect, copyreg)
     __itemsize__
     __weakrefoffset__

super() attributes:
     __self_class__
     __thisclass__

Used in sqlite:
     __adapt__
     __conform__

Used in ctypes:
     __ctype_be__
     __ctype_le__
     __ctypes_from_outparam__

Used in unittest:
     __unittest_expecting_failure__
     __unittest_skip__
     __unittest_skip_why__

float methods, for testing:
     __getformat__
     __setformat__

Used in IDLE RPC:
     __attributes__
     __methods__

Others:
     __alloc__               (bytearray method)
     __args__                (used in bdb)
     __build_class__         (builtins function, used in eval loop)
     __builtins__            (module attribute)
     __decimal_context__     (used in decimal)
     __exception__           (used in pdb)
     __getinitargs__         (used in pickle, datetime)
     __initializing__        (used in importlib)
     __isabstractmethod__    (function/method/descriptor attribute,
                              used in abc, functools, types)
     __ltrace__              (used in eval loop, never set)
     __members__             (Enum attribute, used in many modules)
     __mp_main__             (used in multiprocessing)
     __new_member__          (Enum attribute, used in enum internally)
     __newobj__              (copyreg function,
                              used in pickle, object.__reduce_ex__)
     __newobj_ex__           (copyreg function,
                              used in pickle, object.__reduce_ex__)
     __objclass__            (descriptor/enum attribute, used in
                              inspect, pydoc, doctest, multiprocessing)
     __prepare__             (metaclass method,
                              used in builtins.__build_class__, types)
     __pycache__             (cache directory name)
     __return__              (used in pdb)
     __signature__           (used in inspect, never set)
     __sizeof__              (standard method, used in sys.getsizeof)
     __slotnames__           (used in object.__getstate__ for caching)
     __text_signature__      (function/method/descriptor attribute,
                              used in inspect)
     __trunc__               (used in math.trunc, int, etc)
     __warningregistry__     (used in warnings)
     __weakref__             (used in weakref)
     __wrapped__             (used in inspect, functools, contextlib,
                              asyncio)


[1] http://bugs.python.org/issue23639



More information about the Python-Dev mailing list