mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
Don't encourage 'from types import *' in the types module's docs.
This commit is contained in:
parent
6d199ef14b
commit
2befd247e9
1 changed files with 3 additions and 4 deletions
|
@ -9,14 +9,13 @@
|
||||||
This module defines names for some object types that are used by the standard
|
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.
|
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
|
Also, it does not include some of the types that arise during processing such as
|
||||||
the ``listiterator`` type. It is safe to use ``from types import *`` --- the
|
the ``listiterator`` type. New names exported by future versions of this module
|
||||||
module does not export any names besides the ones listed here. New names
|
will all end in ``Type``.
|
||||||
exported by future versions of this module will all end in ``Type``.
|
|
||||||
|
|
||||||
Typical use is for functions that do different things depending on their
|
Typical use is for functions that do different things depending on their
|
||||||
argument types, like the following::
|
argument types, like the following::
|
||||||
|
|
||||||
from types import *
|
from types import IntType
|
||||||
def delete(mylist, item):
|
def delete(mylist, item):
|
||||||
if type(item) is IntType:
|
if type(item) is IntType:
|
||||||
del mylist[item]
|
del mylist[item]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue