Commit a1e9ef7a authored by Georg Brandl's avatar Georg Brandl

Fix up the types module docs.

parent 6911e3ce
...@@ -42,11 +42,17 @@ The module defines the following names: ...@@ -42,11 +42,17 @@ The module defines the following names:
.. data:: TypeType .. data:: TypeType
ClassType
.. index:: builtin: type .. index:: builtin: type
The type of type objects (such as returned by :func:`type`); alias of the The type of type objects (such as returned by :func:`type`) and user-defined
built-in :class:`type`. classes without metaclass; alias of the built-in :class:`type`.
.. data:: ObjectType
Alias of the built-in :func:`object`.
.. data:: BooleanType .. data:: BooleanType
...@@ -56,15 +62,11 @@ The module defines the following names: ...@@ -56,15 +62,11 @@ The module defines the following names:
.. data:: IntType .. data:: IntType
LongType
The type of integers (e.g. ``1``); alias of the built-in :class:`int`. The type of integers (e.g. ``1``); alias of the built-in :class:`int`.
.. data:: LongType
The type of long integers (e.g. ``1L``); alias of the built-in :class:`long`.
.. data:: FloatType .. data:: FloatType
The type of floating point numbers (e.g. ``1.0``); alias of the built-in The type of floating point numbers (e.g. ``1.0``); alias of the built-in
...@@ -73,8 +75,9 @@ The module defines the following names: ...@@ -73,8 +75,9 @@ The module defines the following names:
.. data:: ComplexType .. data:: ComplexType
The type of complex numbers (e.g. ``1.0j``). This is not defined if Python was The type of complex numbers (e.g. ``1.0j``); alias of the built-in
built without complex number support. :class:`complex`. This is not defined if Python was built without complex
number support.
.. data:: StringType .. data:: StringType
...@@ -96,26 +99,18 @@ The module defines the following names: ...@@ -96,26 +99,18 @@ The module defines the following names:
.. data:: DictType .. data:: DictType
DictionaryType
The type of dictionaries (e.g. ``{'Bacon': 1, 'Ham': 0}``); alias of the The type of dictionaries (e.g. ``{'Bacon': 1, 'Ham': 0}``); alias of the
built-in :class:`dict`. built-in :class:`dict`.
.. data:: DictionaryType
An alternate name for ``DictType``.
.. data:: FunctionType .. data:: FunctionType
LambdaType
The type of user-defined functions and lambdas. The type of user-defined functions and lambdas.
.. data:: LambdaType
An alternate name for ``FunctionType``.
.. data:: GeneratorType .. data:: GeneratorType
The type of generator-iterator objects, produced by calling a generator The type of generator-iterator objects, produced by calling a generator
...@@ -129,50 +124,23 @@ The module defines the following names: ...@@ -129,50 +124,23 @@ The module defines the following names:
The type for code objects such as returned by :func:`compile`. The type for code objects such as returned by :func:`compile`.
.. data:: ClassType
The type of user-defined classes.
.. data:: MethodType .. data:: MethodType
UnboundMethdType
The type of methods of user-defined class instances. The type of methods of user-defined class instances.
.. data:: UnboundMethodType
An alternate name for ``MethodType``.
.. data:: BuiltinFunctionType .. data:: BuiltinFunctionType
BuiltinMethodType
The type of built-in functions like :func:`len` or :func:`sys.exit`. The type of built-in functions like :func:`len` or :func:`sys.exit`.
.. data:: BuiltinMethodType
An alternate name for ``BuiltinFunction``.
.. data:: ModuleType .. data:: ModuleType
The type of modules. The type of modules.
.. data:: FileType
The type of open file objects such as ``sys.stdout``; alias of the built-in
:class:`file`.
.. data:: RangeType
.. index:: builtin: range
The type of range objects returned by :func:`range`; alias of the built-in
:class:`range`.
.. data:: SliceType .. data:: SliceType
.. index:: builtin: slice .. index:: builtin: slice
...@@ -197,6 +165,7 @@ The module defines the following names: ...@@ -197,6 +165,7 @@ The module defines the following names:
traceback object. traceback object.
.. XXX!
.. data:: BufferType .. data:: BufferType
.. index:: builtin: buffer .. index:: builtin: buffer
...@@ -228,12 +197,3 @@ The module defines the following names: ...@@ -228,12 +197,3 @@ The module defines the following names:
``datetime.timedelta.days``. This constant is not defined in implementations of ``datetime.timedelta.days``. This constant is not defined in implementations of
Python that do not have such extension types, so for portable code use Python that do not have such extension types, so for portable code use
``hasattr(types, 'MemberDescriptorType')``. ``hasattr(types, 'MemberDescriptorType')``.
.. data:: StringTypes
A sequence containing ``StringType`` and ``UnicodeType`` used to facilitate
easier checking for any string object. Using this is more portable than using a
sequence of the two string types constructed elsewhere since it only contains
``UnicodeType`` if it has been built in the running version of Python. For
example: ``isinstance(s, types.StringTypes)``.
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