Fredrik Lundh wrote:
> Consider a dictionary with one million items.  The following operations
>
>     k = d.keys()
>     v = d.values()
>
> creates two list objects, while
>
>     i = d.items()
>
> creates just over one million objects.  In your "equivalent" example,
> you're calling d.items() twice to produce two million objects, none
> of which you really care about.

This is what I get from the doc :
a.items()       a copy of a's list of (key, value) pairs        (3)
a.keys()        a copy of a's list of keys      (3)
a.values()      a copy of a's list of values

I can't derive what you mean by "two list objects" vs "million
objects".

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to