|
|
|
|
|
by dozzie
2979 days ago
|
|
> [...] what makes you implicitly know how the 'IN' behaves in python, and that it won't convert to the keys() method of the dict to get a list with the same behaviour as in a list? Because it would be the dumb way to do it. You have a lookup procedure to
extract a value from a hash. A procedure to check if the key is present in the
hash will look exactly the same, barring the value being returned. Libraries usually work the same way as you would write yourself if you were
trained in the task, so it's easy to guess. |
|
I'll quote part of it, regarding your "so it's easy to guess"
"In the face of ambiguity, refuse the temptation to guess."
Source: https://www.python.org/dev/peps/pep-0020/