diff options
author | Georg Brandl <georg@python.org> | 2007-04-21 15:47:16 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2007-04-21 15:47:16 (GMT) |
commit | a18af4e7a2091d11478754eb66ae387a85535763 (patch) | |
tree | fea8015d656cfee937bb6f3d106e6ca0e9f19d78 /Objects | |
parent | 4d2adcca52ced412d4bdf131b872729c43520d58 (diff) | |
download | cpython-a18af4e7a2091d11478754eb66ae387a85535763.zip cpython-a18af4e7a2091d11478754eb66ae387a85535763.tar.gz cpython-a18af4e7a2091d11478754eb66ae387a85535763.tar.bz2 |
PEP 3114: rename .next() to .__next__() and add next() builtin.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/exceptions.c | 2 | ||||
-rw-r--r-- | Objects/typeobject.c | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/Objects/exceptions.c b/Objects/exceptions.c index be3302b..6832fd9 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -369,7 +369,7 @@ SimpleExtendsException(PyExc_StandardError, TypeError, * StopIteration extends Exception */ SimpleExtendsException(PyExc_Exception, StopIteration, - "Signal the end from iterator.next()."); + "Signal the end from iterator.__next__()."); /* diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 1ccd97b..c6091df 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -4636,7 +4636,7 @@ static PyObject * slot_tp_iternext(PyObject *self) { static PyObject *next_str; - return call_method(self, "next", &next_str, "()"); + return call_method(self, "__next__", &next_str, "()"); } static PyObject * @@ -5031,8 +5031,8 @@ static slotdef slotdefs[] = { "x.__ge__(y) <==> x>=y"), TPSLOT("__iter__", tp_iter, slot_tp_iter, wrap_unaryfunc, "x.__iter__() <==> iter(x)"), - TPSLOT("next", tp_iternext, slot_tp_iternext, wrap_next, - "x.next() -> the next value, or raise StopIteration"), + TPSLOT("__next__", tp_iternext, slot_tp_iternext, wrap_next, + "x.__next__() <==> next(x)"), TPSLOT("__get__", tp_descr_get, slot_tp_descr_get, wrap_descr_get, "descr.__get__(obj[, type]) -> value"), TPSLOT("__set__", tp_descr_set, slot_tp_descr_set, wrap_descr_set, |