I wonder what is better to do:
d = {'a': 1, 'b': 2}
'a' in d
True
or:
d = {'a': 1, 'b': 2}
d.has_key('a')
True
393
51
|
I wonder what is better to do:
or:
| |||
add a comment
|
546
|
In fact | |||
179
|
While the following observation is not always true, you'll notice that usually, in Python, the faster solution is more elegant and Pythonic; that's why | ||||||||||||
|
43
|
According to python docs:
| ||||
|
28
|
Use | ||||||||||||
|
13
|
There is one example where If you use Fix is obviously trivial:
| ||
8
|
|
in
works with 2.6 too right? – Logan Jan 17 '13 at 4:07