by csdigi · 13y ago · 0 comments
In the provided example he calls get on an empty dictionary for the key 1, then calls getattr of 'a' on an int. Finally he calls it again with an optional default argument of None.
The difference is made apparent by the example:
In [13]: test = {'values': 1}
In [14]: getattr(test, 'values') Out[14]: <function values>
In [15]: test.get('values') Out[15]: 1
No comments yet.