|
|
|
|
|
by untothebreach
4669 days ago
|
|
It seems to be a pattern in Python APIs to allow the caller to decide if a given function call should throw an exception when an error occurs. For example, a = some_dict['nonexistent_key']
would raise a KeyError, while a = some_dict.get('nonexistent_key', 'DEFAULT')
would return 'DEFAULT' instead. |
|