A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2000-November/010669.html below:

[Python-Dev] Assertions

[Python-Dev] Assertions [Python-Dev] AssertionsPaul Prescod paulp@ActiveState.com
Tue, 21 Nov 2000 16:32:50 -0800
Tim Peters wrote:
> 
> ...
> 
> -1.  User input is never trustworthy.  Your and your users' software lives
> will be a lot happier if you stick to the rule that an assertion failure
> always (always!) announces a bug in the implementation -- assertion failure
> is never a user's fault.  

So you prefer

if __debug__ and node.nodeType!=ELEMENT_TYPE: 
    raise TypeError

Unfortunately there's no way to turn that off at "compile time" so you
always incur the __debug__ lookup cost. That would send us back to two
versions of the methods.

Maybe testing would indicate that the performance implications are
minor. If so, I wouldn't mind having the type checks in there.

 Paul Prescod



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