butler icon indicating copy to clipboard operation
butler copied to clipboard

implement 'at' similar to 'get' but throws error

Open atmb4u opened this issue 10 years ago • 0 comments

Ref: http://www.reddit.com/r/Python/comments/22fdpj/butler_python_dictionaries_and_lists_on_steroids/cgn16dy

python dicts have a way to now throw if the key isn't found:

foo['x'] # <- throws!
foo.get('x') # <- returns None

You could have the same thing:

foo.at('a', 'b', 'c') # <- throws!
foo.get('a', 'b', 'c') # returns None

atmb4u avatar Aug 01 '14 17:08 atmb4u