[Python-checkins] CVS: python/nondist/peps pep-0234.txt,1.5,1.6
Guido van Rossum
gvanrossum@users.sourceforge.net
Thu, 26 Apr 2001 14:50:12 -0700
Update of /cvsroot/python/python/nondist/peps
In directory usw-pr-cvs1:/tmp/cvs-serv21542
Modified Files:
pep-0234.txt
Log Message:
Added some more discussion.
Index: pep-0234.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0234.txt,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** pep-0234.txt 2001/04/26 13:39:59 1.5
--- pep-0234.txt 2001/04/26 21:50:09 1.6
***************
*** 109,113 ****
will have a hard time differentiating between user-level protocols
and interpreter-level ones. AFAIK, .next() would be the first
! low-level API not using this convention."
--- 109,116 ----
will have a hard time differentiating between user-level protocols
and interpreter-level ones. AFAIK, .next() would be the first
! low-level API not using this convention." My (BDFL's) response:
! there are other important protocols with a user-level name
! (e.g. keys()), and I don't see the importance of this particular
! rule.
***************
*** 148,152 ****
implement __iter__() returning itself.
! There is some controversy here:
- The name iter() is an abbreviation. Alternatives proposed
--- 151,155 ----
implement __iter__() returning itself.
! Discussion:
- The name iter() is an abbreviation. Alternatives proposed
***************
*** 157,160 ****
--- 160,170 ----
with an sentinel value) is somewhat ugly. I haven't seen a
better name for the second operation though.
+
+ - It was originally proposed that rather than having a next()
+ method, an iterator object should simply be callable. This was
+ rejected in favor of an explicit next() method. The reason is
+ clarity: if you don't know the code very well, "x = s()" does
+ not give a hint about what it does; but "x = s.next()" is pretty
+ clear.