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/2013-November/130256.html below:

[Python-Dev] (#19562) Asserts in Python stdlib code (datetime.py)

[Python-Dev] (#19562) Asserts in Python stdlib code (datetime.py) [Python-Dev] (#19562) Asserts in Python stdlib code (datetime.py)Mark Janssen dreamingforward at gmail.com
Sat Nov 16 04:32:17 CET 2013
> Should stdlib code use assert at all?
>
> If user input can trigger an assert, then the code should raise a normal
> exception that will not disappear with -OO.
>
> If the assert is testing program logic, then it seems that the test belongs
> in the test file, in this case, test/test_datetime.py. For example, consider
> the following (backwards) code.
>
> Is there any policy on use of assert in stdlib production code?

It is my assertion that assert should only be used where a
system-level problem would occur, where you cannot trap an error
condition.

-- 
MarkJ
Tacoma, Washington
More information about the Python-Dev mailing list

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