[Python-checkins] CVS: python/nondist/peps pep-0234.txt,1.14,1.15

Tim Peters tim_one@users.sourceforge.net
Fri, 04 May 2001 17:14:58 -0700


Update of /cvsroot/python/python/nondist/peps
In directory usw-pr-cvs1:/tmp/cvs-serv12706/python/nondist/peps

Modified Files:
	pep-0234.txt 
Log Message:
Make PyIter_Next() a little smarter (wrt its knowledge of iterator
internals) so clients can be a lot dumber (wrt their knowledge).


Index: pep-0234.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0234.txt,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** pep-0234.txt	2001/05/01 17:52:06	1.14
--- pep-0234.txt	2001/05/05 00:14:56	1.15
***************
*** 44,51 ****
      structure, for obtaining the next value in the iteration.  To use
      this slot, a new C API function PyIter_Next() is added.  The
!     signature for both the slot and the API function is as follows:
!     the argument is a PyObject * and so is the return value.  When the
!     return value is non-NULL, it is the next value in the iteration.
!     When it is NULL, there are three possibilities:
  
      - No exception is set; this implies the end of the iteration.
--- 44,52 ----
      structure, for obtaining the next value in the iteration.  To use
      this slot, a new C API function PyIter_Next() is added.  The
!     signature for both the slot and the API function is as follows,
!     although the NULL return conditions differ:  the argument is a
!     PyObject * and so is the return value.  When the return value is
!     non-NULL, it is the next value in the iteration.  When it is NULL,
!     then for the tp_iternext slot there are three possibilities:
  
      - No exception is set; this implies the end of the iteration.
***************
*** 56,59 ****
--- 57,69 ----
      - Some other exception is set; this means that an error occurred
        that should be propagated normally.
+ 
+     The higher-level PyIter_Next() function clears the StopIteration
+     exception (or derived exception) when it occurs, so its NULL return
+     conditions are simpler:
+ 
+     - No exception is set; this means iteration has ended.
+ 
+     - Some exception is set; this means an error occurred, and should
+       be propagated normally.
  
      In addition to the tp_iternext slot, every iterator object must