[Python-Dev] defaultdict and on_missing() (original) (raw)
Guido van Rossum guido at python.org
Tue Feb 28 18:02:55 CET 2006
- Previous message: [Python-Dev] defaultdict and on_missing()
- Next message: [Python-Dev] defaultdict and on_missing()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 2/28/06, Nick Coghlan <ncoghlan at gmail.com> wrote:
Greg Ewing wrote: > Nick Coghlan wrote: > >> I wouldn't mind seeing one of the early ideas from PEP 340 being >> resurrected some day, such that the signature for the special method >> was "next(self, input)" and for the builtin "next(iterator, >> input=None)" > > Aren't we getting an argument to next() anyway? > Or was that idea dropped?
PEP 342 opted to extend the generator API instead (using "send") and leave the iterator protocol alone for the time being.
One of the main reasons for this was the backwards compatibility problems at the C level. The C implementation doesn't take an argument. Adding an argument would cause all sorts of code breakage and possible segfaults (if there's 3rd party code calling tp_next for example).
In 3.0 we could fix this.
-- --Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] defaultdict and on_missing()
- Next message: [Python-Dev] defaultdict and on_missing()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]