Message157965
| Author |
Jimbofbx |
| Recipients |
Jim.Jewett, Jimbofbx, Ramchandra Apte, jcea, pitrou, python-dev, rhettinger, serhiy.storchaka, skrah |
| Date |
2012年04月10日.17:00:09 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1334077210.31.0.804080673441.issue14478@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
In the patch:
This:
+ except AttributeError:
+ pass
should be:
+ except:
<everything inside except statement>
Checking for the AttributeError is very slightly slower. Not by a lot, but I think if we're going for speed we might as well be as fast as possible. I can't imagine any other exception coming from that try statement.
Using except: pass as opposed to sticking everything inside the except statement is also very slightly slower as well
Simple test case, 10 million loops:
except: 7.140999794006348
except AttributeError: 7.8440001010894775
Exception code
in except: 7.483999967575073
after except/pass: 7.75 |
|