Paul Rubin wrote:
Steven D'Aprano <st...@remove-this-cybersource.com.au> writes:
For the record, the four lines Paul implies are "confusing" are:

try:
    d[key] += value
except KeyError:
    d[key] = value

Consider what happens if the computation of "key" or "value" itself
raises KeyError.

Isn't key and value just a simple variables/names? Why should it ever raises KeyError? The only other error that try-block code could ever possibly throw are NameError and possibly MemoryError.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to