Raymond Hettinger <[email protected]> added the comment:
Instead of doing lookups with square brackets, consider using the dict.get()
method that returns a default value rather than raising a KeyError for a
missing key.
composer2[input1] --> composer2.get(input1, 0)
----------
nosy: +rhettinger
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue39240>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com