[Python-checkins] CVS: python/dist/src/Lib types.py,1.21,1.22
Tim Peters
tim_one@users.sourceforge.net
2001年9月25日 15:02:06 -0700
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv29611/python/Lib
Modified Files:
types.py
Log Message:
SF [#463737] Add types.CallableIterType
Rather than add umpteen new obscure internal Iter types, got rid of all of
them. See the new comment.
Index: types.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/types.py,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** types.py 2001年09月13日 05:38:55 1.21
--- types.py 2001年09月25日 22:02:03 1.22
***************
*** 7,10 ****
--- 7,15 ----
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
***************
*** 77,83 ****
EllipsisType = type(Ellipsis)
- DictIterType = type(iter({}))
- SequenceIterType = type(iter([]))
- FunctionIterType = type(iter(lambda: 0, 0))
DictProxyType = type(TypeType.__dict__)
--- 82,85 ----