[Python-Dev] Weak Dictionary Iteration Behavior in Python 3

Josiah Carlson josiah.carlson at gmail.com
Sun Sep 14 02:45:10 CEST 2008


On Sat, Sep 13, 2008 at 5:21 PM, Scott David Daniels
<Scott.Daniels at acm.org> wrote:
> Josiah Carlson wrote:
>>
>> On Sat, Sep 13, 2008 at 1:20 PM, Armin Ronacher wrote:
>>>
>>> Iterating over weak key dictionaries might not be the most common task
>>> but I
>>> know some situations where this is necessary.  Unfortunately I can't see
>>> a
>>> way to achieve that in Python 3.
>>
>> i = list(d.keys())
>
> Surely
>    i = list(d)
> is a more reasonable way to do this.  I seldom find a reason
> to use .keys

Definitely.  I was being lazy in my use of list(d.keys()) ;)

 - Josiah


More information about the Python-Dev mailing list