The rap against "while True:" loops
lie.1296 at gmail.com
Sun Oct 18 11:21:31 CEST 2009
Paul Rubin wrote:
> Steven D'Aprano <steve at REMOVE-THIS-cybersource.com.au> writes:
>> For the record, the four lines Paul implies are "confusing" are:
>> 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.
More information about the Python-list