| |
| The type of ``None``. |
| |
| |
| .. data:: TypeType |
| |
| .. index:: builtin: type |
| |
n | The type of type objects (such as returned by :func:`type`). |
n | The type of type objects (such as returned by :func:`type`); alias of the |
| built-in :class:`type`. |
| |
| |
| .. data:: BooleanType |
| |
n | The type of the :class:`bool` values ``True`` and ``False``; this is an alias of |
n | The type of the :class:`bool` values ``True`` and ``False``; alias of the |
| the built-in :func:`bool` function. |
| built-in :class:`bool`. |
| |
| .. versionadded:: 2.3 |
| |
| |
| .. data:: IntType |
| |
n | The type of integers (e.g. ``1``). |
n | The type of integers (e.g. ``1``); alias of the built-in :class:`int`. |
| |
| |
| .. data:: LongType |
| |
n | The type of long integers (e.g. ``1L``). |
n | The type of long integers (e.g. ``1L``); alias of the built-in :class:`long`. |
| |
| |
| .. data:: FloatType |
| |
n | The type of floating point numbers (e.g. ``1.0``). |
n | The type of floating point numbers (e.g. ``1.0``); alias of the built-in |
| :class:`float`. |
| |
| |
| .. data:: ComplexType |
| |
| The type of complex numbers (e.g. ``1.0j``). This is not defined if Python was |
| built without complex number support. |
| |
| |
| .. data:: StringType |
| |
n | The type of character strings (e.g. ``'Spam'``). |
n | The type of character strings (e.g. ``'Spam'``); alias of the built-in |
| :class:`str`. |
| |
| |
| .. data:: UnicodeType |
| |
| The type of Unicode character strings (e.g. ``u'Spam'``). This is not defined |
n | if Python was built without Unicode support. |
n | if Python was built without Unicode support. It's an alias of the built-in |
| :class:`unicode`. |
| |
| |
| .. data:: TupleType |
| |
n | The type of tuples (e.g. ``(1, 2, 3, 'Spam')``). |
n | The type of tuples (e.g. ``(1, 2, 3, 'Spam')``); alias of the built-in |
| :class:`tuple`. |
| |
| |
| .. data:: ListType |
| |
n | The type of lists (e.g. ``[0, 1, 2, 3]``). |
n | The type of lists (e.g. ``[0, 1, 2, 3]``); alias of the built-in |
| :class:`list`. |
| |
| |
| .. data:: DictType |
| |
n | The type of dictionaries (e.g. ``{'Bacon': 1, 'Ham': 0}``). |
n | The type of dictionaries (e.g. ``{'Bacon': 1, 'Ham': 0}``); alias of the |
| built-in :class:`dict`. |
| |
| |
| .. data:: DictionaryType |
| |
| An alternate name for ``DictType``. |
| |
| |
| .. data:: FunctionType |
n | LambdaType |
| |
n | The type of user-defined functions and lambdas. |
n | The type of user-defined functions and functions created by :keyword:`lambda` |
| |
| expressions. |
| |
| .. data:: LambdaType |
| |
| An alternate name for ``FunctionType``. |
| |
| |
| .. data:: GeneratorType |
| |
n | The type of generator-iterator objects, produced by calling a generator |
n | The type of :term:`generator`-iterator objects, produced by calling a |
| function. |
| generator function. |
| |
| .. versionadded:: 2.2 |
| |
| |
| .. data:: CodeType |
| |
| .. index:: builtin: compile |
| |
| The type for code objects such as returned by :func:`compile`. |
| |
| |
| .. data:: ClassType |
| |
n | The type of user-defined classes. |
n | The type of user-defined old-style classes. |
| |
| |
| .. data:: InstanceType |
| |
| The type of instances of user-defined classes. |
| |
| |
| .. data:: MethodType |
| |
| |
| .. data:: UnboundMethodType |
| |
| An alternate name for ``MethodType``. |
| |
| |
| .. data:: BuiltinFunctionType |
n | BuiltinMethodType |
| |
n | The type of built-in functions like :func:`len` or :func:`sys.exit`. |
n | The type of built-in functions like :func:`len` or :func:`sys.exit`, and |
| |
| methods of built-in classes. (Here, the term "built-in" means "written in |
| |
| C".) |
| .. data:: BuiltinMethodType |
| |
| An alternate name for ``BuiltinFunction``. |
| |
| |
| .. data:: ModuleType |
| |
| The type of modules. |
| |
| |
| .. data:: FileType |
| |
n | The type of open file objects such as ``sys.stdout``. |
n | The type of open file objects such as ``sys.stdout``; alias of the built-in |
| :class:`file`. |
| |
| |
| .. data:: XRangeType |
| |
| .. index:: builtin: xrange |
| |
n | The type of range objects returned by :func:`xrange`. |
n | The type of range objects returned by :func:`xrange`; alias of the built-in |
| :class:`xrange`. |
| |
| |
| .. data:: SliceType |
| |
| .. index:: builtin: slice |
| |
n | The type of objects returned by :func:`slice`. |
n | The type of objects returned by :func:`slice`; alias of the built-in |
| :class:`slice`. |
| |
| |
| .. data:: EllipsisType |
| |
| The type of ``Ellipsis``. |
| |
| |
| .. data:: TracebackType |
| |
| .. data:: NotImplementedType |
| |
| The type of ``NotImplemented`` |
| |
| |
| .. data:: GetSetDescriptorType |
| |
n | The type of objects defined in extension modules with ``PyGetSetDef``, such as |
n | The type of objects defined in extension modules with ``PyGetSetDef``, such |
| ``FrameType.f_locals`` or ``array.array.typecode``. This constant is not |
| as ``FrameType.f_locals`` or ``array.array.typecode``. This type is used as |
| defined in implementations of Python that do not have such extension types, so |
| descriptor for object attributes; it has the same purpose as the |
| for portable code use ``hasattr(types, 'GetSetDescriptorType')``. |
| :class:`property` type, but for classes defined in extension modules. |
| |
| .. versionadded:: 2.5 |
| |
| |
| .. data:: MemberDescriptorType |
| |
n | The type of objects defined in extension modules with ``PyMemberDef``, such as |
n | The type of objects defined in extension modules with ``PyMemberDef``, such |
| ``datetime.timedelta.days``. This constant is not defined in implementations of |
| as ``datetime.timedelta.days``. This type is used as descriptor for simple C |
| Python that do not have such extension types, so for portable code use |
| data members which use standard conversion functions; it has the same purpose |
| ``hasattr(types, 'MemberDescriptorType')``. |
| as the :class:`property` type, but for classes defined in extension modules. |
| In other implementations of Python, this type may be identical to |
| ``GetSetDescriptorType``. |
| |
| .. versionadded:: 2.5 |
| |
| |
| .. 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)``. |
| |
| .. versionadded:: 2.2 |
t | |