[MERGE] remove has_key() usage
Jamie Wilkinson
jaq at spacepants.org
Wed Aug 30 05:35:33 BST 2006
This one time, at band camp, Robey Pointer wrote:
>>Is there any particular reason why 'x in foo' is better than
>>'foo.has_key(x)'? I suppose 'in' is supported by more than just dicts
>>(sets, lists, etc).
>>Just wondering if there is some python advice that I haven't heard of.
>
>I just found out this week: "has_key" has been deprecated for a
>while, in favor of the "x in y" syntax. Although it's too early to
>be very concerned about it, has_key() will also be gone in python 3.0.
I found out about this on the Pylons list the other day, and apparently, the
'in' style is also faster in python 2.4 than has_key.
More information about the bazaar
mailing list