diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-09-25 22:02:03 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-09-25 22:02:03 (GMT) |
commit | 26991a7f77b43cbc529f4304c1702737b2999174 (patch) | |
tree | 8e6388dd41a94c3429374e75cb09ef242586071b /Lib | |
parent | 45653503ec0a0f8db383aa3532bc09450970c74a (diff) | |
download | cpython-26991a7f77b43cbc529f4304c1702737b2999174.zip cpython-26991a7f77b43cbc529f4304c1702737b2999174.tar.gz cpython-26991a7f77b43cbc529f4304c1702737b2999174.tar.bz2 |
SF [#463737] Add types.CallableIterType
Rather than add umpteen new obscure internal Iter types, got rid of all of
them. See the new comment.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/types.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/types.py b/Lib/types.py index 9419405..1bb560c 100644 --- a/Lib/types.py +++ b/Lib/types.py @@ -6,6 +6,11 @@ from __future__ import generators import sys +# Iterators in Python aren't a matter of type but of protocol. A large +# and changing number of builtin types implement *some* flavor of +# iterator. Don't check the type! Use hasattr to check for both +# "__iter__" and "next" attributes instead. + NoneType = type(None) TypeType = type ObjectType = object @@ -76,9 +81,6 @@ except TypeError: SliceType = type(slice(0)) EllipsisType = type(Ellipsis) -DictIterType = type(iter({})) -SequenceIterType = type(iter([])) -FunctionIterType = type(iter(lambda: 0, 0)) DictProxyType = type(TypeType.__dict__) del sys, _f, _C, _x # Not for export |