Le Wed, 16 Oct 2013 14:01:37 +0200, Victor Stinner <victor.stin...@gmail.com> a écrit : > 2013/10/16 Antoine Pitrou <solip...@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. _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com