On 9/4/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> After Nick's last message I went searching for "iteritems" in the docs.  I
> fixed a couple places (not yet checked in), but eventually came across
> Mailbox.iteritems.  Looking at the mailbox.py code, sure enough, it still
> exists:
>
>     def iteritems(self):
>         """Return an iterator over (key, message) tuples."""
>         for key in self.keys():
>             try:
>                 value = self[key]
>             except KeyError:
>                 continue
>             yield (key, value)
>
>     def items(self):
>         """Return a list of (key, message) tuples. Memory intensive."""
>         return list(self.iteritems())
>
> Should it be renamed items and the second def'n deleted?  Same for iterkeys,
> itervalues where they appear?

It is incorrect to replace items() with iteritems() though -- it
should be replaced with a "view" like sketched in PEP 3106.

I think this will be a fairly large project; ATM we don't even have a
reusable implementation of dict views (the version in dictobject.c is
explicitly restricted to dict instances). It would be a good idea to
review the conformance of every stdlib API that tries to look like a
mapping, and make them conform to the new mapping ABCs in PEP 3119.
(Ditto for sequences and sets except there are so few of those.)

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to