[Python-Dev] Re: Reiterability
Alex Martelli
aleaxit at yahoo.com
Mon Oct 20 18:09:39 EDT 2003
More information about the Python-Dev mailing list
Mon Oct 20 18:09:39 EDT 2003
- Previous message: [Python-Dev] Re: Reiterability
- Next message: [Python-Dev] Re: Reiterability
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Monday 20 October 2003 07:43 pm, Guido van Rossum wrote: ... > I'm not sure why you say it's separate from cloning; it seems to me > that copy.copy(iter(range(10))) should return *exactly* what we'd want > the proposed clone operation to return. I'd be tickled pink if it did, but I would have expected a shallow copy to return an iterator that's not necessarily independent from the starting one. Maybe I have a bad mental model of the "depth" (indirectness) of iterators? > I see this as a plea to add __copy__ and __deepcopy__ methods to all > standard iterators for which it makes sense. (Or maybe only __copy__ > -- I'm not sure what value __deepcopy__ would add.) Hmmm, copy the underlying sequence as well? Don't have any use case for it, but that's what would feel unsurprising to me (as I have already mentioned I may not have the right mental model of an iterator...). > I find this a reasonable request for the iterators belonging to > stndard containers (list, tuple, dict). I guess that some of the > iterators in itertools might also support this easily. Perhaps this > would be the road to supporting iterator cloning? It would surely do a lot to let me clone things, yes, and in fact doing it with the existing __copy__ protocol sounds much better than sprouting a new one. (Thanks for the confirmations and clarifications on file internals. btw, any news of the new experimental file things you were playing with back at PythonUK...?) Alex
- Previous message: [Python-Dev] Re: Reiterability
- Next message: [Python-Dev] Re: Reiterability
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list