The rap against "while True:" loops

Paul Rubin http
Sun Oct 18 02:37:51 EDT 2009


Steven D'Aprano <steve at 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.



More information about the Python-list mailing list