Showing content from http://mail.python.org/pipermail/python-dev/attachments/20110705/6625e35e/attachment.html below:
<p>Exception is for catching, not raising.</p>
<div class="gmail_quote">On Jul 4, 2011 11:57 AM, "Victor Stinner" <<a href="mailto:victor.stinner@haypocalc.com">victor.stinner@haypocalc.com</a>> wrote:<br type="attribution">> Le lundi 04 juillet 2011 à 18:23 +0200, Antoine Pitrou a écrit :<br>
>> On Mon, 04 Jul 2011 18:06:53 +0200<br>>> victor.stinner <<a href="mailto:python-checkins@python.org">python-checkins@python.org</a>> wrote:<br>>> > <a href="http://hg.python.org/cpython/rev/7eef821ab20d">http://hg.python.org/cpython/rev/7eef821ab20d</a><br>
>> > changeset: 71197:7eef821ab20d<br>>> > user: Victor Stinner <<a href="mailto:victor.stinner@haypocalc.com">victor.stinner@haypocalc.com</a>><br>>> > date: Mon Jul 04 18:06:35 2011 +0200<br>
>> > summary:<br>>> > Issue #12469: replace assertions by explicit if+raise<br>> <br>> <br>>> Instead of generic Exception, it would be better to use AssertionError.<br>> <br>> and<br>
> <br>>> or in many cases given this was in unittests... use the self.assertFoo<br>>> methods and avoid assert and if statements all together.<br>> <br>> The code is running in a subprocess (python -c ...), not in an<br>
> unittest.TestCase, so I cannot use self.assertFoo and it doesn't really<br>> matter if the exception is an Exception or an AssertionError.<br>> <br>>> What is the reason for this change anyway -- as far as I can<br>
>> see this code is never run with -O.<br>> <br>> I'm not sure that the code will never be running using -O, so I prefer<br>> to use an explicit if+raise. I don't like the assert statement because<br>
> it doesn't provide any information about the failure (content of the<br>> variables) by default.<br>> <br>> Victor<br>> <br>> _______________________________________________<br>> Python-Dev mailing list<br>
> <a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>> <a href="http://mail.python.org/mailman/listinfo/python-dev">http://mail.python.org/mailman/listinfo/python-dev</a><br>> Unsubscribe: <a href="http://mail.python.org/mailman/options/python-dev/guido%40python.org">http://mail.python.org/mailman/options/python-dev/guido%40python.org</a><br>
</div>
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