Le Wed, 16 Oct 2013 14:01:37 +0200, Victor Stinner <victor.stinner at gmail.com> a écrit : > 2013/10/16 Antoine Pitrou <solipsis at pitrou.net>: > >> By the way, what are the performances of contextlib.ignore()? > >> Exceptions can be slow in some cases. Adding something even slower > >> would not be a good idea. > > > > A "try" block which succeeds is fast. > > Ah yes, I never reminder this fact. I try to not care too much of > micro-optimizations :-) It's not so much a micro-optimization than the fact that pushing a block on the stack is very cheap. IIRC, what is expensive is: - creating the exception object with the associated traceback - matching the exception in the "exception SomeException" clause I don't have numbers, though :-) Regards Antoine.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4