[Python-checkins] CVS: python/dist/src/Misc NEWS,1.147,1.148
Guido van Rossum
gvanrossum@users.sourceforge.net
Tue, 01 May 2001 13:54:32 -0700
Update of /cvsroot/python/python/dist/src/Misc
In directory usw-pr-cvs1:/tmp/cvs-serv13008
Modified Files:
NEWS
Log Message:
Add more news about iterators.
Index: NEWS
===================================================================
RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v
retrieving revision 1.147
retrieving revision 1.148
diff -C2 -r1.147 -r1.148
*** NEWS 2001/05/01 20:45:30 1.147
--- NEWS 2001/05/01 20:54:30 1.148
***************
*** 4,7 ****
--- 4,19 ----
Core
+ - Dictionary objects now support the "in" operator: "x in dict" means
+ the same as dict.has_key(x).
+
+ - Iterators were added; this is a generalized way of providing values
+ to a for loop. See PEP 234. There's a new built-in function iter()
+ to return an iterator. There's a new protocol to get the next value
+ from an iterator using the next() method (in Python) or the
+ tp_iternext slot (in C). There's a new protocol to get iterators
+ using the __iter__() method (in Python) or the tp_iter slot (in C).
+ Iterating (i.e. a for loop) over a dictionary generates its keys.
+ Iterating over a file generates its lines.
+
- The following functions were generalized to work nicely with iterator
arguments: