summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-08-23 15:14:57 (GMT)
committerGeorg Brandl <georg@python.org>2008-08-23 15:14:57 (GMT)
commitd66a02951138ef214fde35782dd56f0e263b5dd0 (patch)
tree044979a2d62e3b7de9255a43e81069c590482497 /Doc
parent50d1f7935d7155fc4cf243411b5a2f1a77cf06dd (diff)
downloadcpython-d66a02951138ef214fde35782dd56f0e263b5dd0.zip
cpython-d66a02951138ef214fde35782dd56f0e263b5dd0.tar.gz
cpython-d66a02951138ef214fde35782dd56f0e263b5dd0.tar.bz2
Remove outdated example from types module doc. Since the types left
in the modules are obscure, I didn't add a substitute example.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/types.rst41
1 files changed, 10 insertions, 31 deletions
diff --git a/Doc/library/types.rst b/Doc/library/types.rst
index e3cbef5..8ae9f88 100644
--- a/Doc/library/types.rst
+++ b/Doc/library/types.rst
@@ -1,4 +1,3 @@
-
:mod:`types` --- Names for built-in types
=========================================
@@ -7,41 +6,19 @@
This module defines names for some object types that are used by the standard
-Python interpreter, but not for the types defined by various extension modules.
-Also, it does not include some of the types that arise during processing such as
-the ``listiterator`` type. New names exported by future versions of this module
-will all end in ``Type``.
-
-Typical use is for functions that do different things depending on their
-argument types, like the following::
-
- from types import IntType
- def delete(mylist, item):
- if type(item) is IntType:
- del mylist[item]
- else:
- mylist.remove(item)
-
-Starting in Python 2.2, built-in factory functions such as :func:`int` and
-:func:`str` are also names for the corresponding types. This is now the
-preferred way to access the type instead of using the :mod:`types` module.
-Accordingly, the example above should be written as follows::
-
- def delete(mylist, item):
- if isinstance(item, int):
- del mylist[item]
- else:
- mylist.remove(item)
-
-Starting in Python 3.0 all types that are also available as builtins are no
-longer exposed through the types module.
+Python interpreter, but not exposed as builtins like :class:`int` or
+:class:`str` are. Also, it does not include some of the types that arise
+transparently during processing such as the ``listiterator`` type.
+
+Typical use is for :func:`isinstance` or :func:`issubclass` checks.
The module defines the following names:
.. data:: FunctionType
LambdaType
- The type of user-defined functions and lambdas.
+ The type of user-defined functions and functions created by :keyword:`lambda`
+ expressions.
.. data:: GeneratorType
@@ -65,7 +42,9 @@ The module defines the following names:
.. 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`, and
+ methods of built-in classes. (Here, the term "built-in" means "written in
+ C".)
.. data:: ModuleType