3 ms·
Huh? The standard behavior in Python is to throw an exception if the key does not exist.
by comex 16y ago
Huh? The standard behavior in Python is to throw an exception if the key does not exist.
- gcr 16y agoI think rgarcia was talking about defaultdict and friends, see http://docs.python.org/library/collections.html#collections.defaultdict http://docs.python.org/library/collections.html#collections.... Classes that implement __getitem__ can behave however they want when you use brackets on them. See http://docs.python.org/reference/datamodel.html#object.__getitem__ http://docs.python.org/reference/datamodel.html#object.__get...