3 ms·
> As far as I know, the only way to access elements of the dictionary is through functions. I fear these methods are deprecated in future versions in favor of t
by chrismorgan 13y ago
> As far as I know, the only way to access elements of the dictionary is through functions. I fear these methods are deprecated in future versions in favor of the square brackets [] notation.
I presume ``(.__getitem__ obj key)`` would work, or at least ``(obj.__getitem__ key)``.
``dict.get(key)`` is not deprecated. It's quite different to ``obj[key]`` (i.e. ``dict.__get__(obj, key)``) and is very useful:
>>> help(dict.get)
Help on method_descriptor:
get(...)
D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.