This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: default __debug__ value and asserts
Type: behavior Stage: resolved
Components: Interpreter Core, Tests Versions: Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: ezio.melotti, michael.foord, pitrou, serhiy.storchaka, xwild
Priority: normal Keywords:

Created on 2014-01-16 08:23 by xwild, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (4)
msg208256 - (view) Author: (xwild) Date: 2014-01-16 08:23
Why the python sets the "__debug__" builtin = True by default?
It causes that people never use the "assert" construction 
by their programms in a regular way.

it's too hard to explain everyone that "-O" is required by a script.
It's very usefull instruction and actually it's blocked by default.
msg208267 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-01-16 09:32
Specify the -O option in she-bang:

#!/usr/bin/env python3 -O
msg208268 - (view) Author: (xwild) Date: 2014-01-16 09:42
Yes it's acceptable, but why the debug mode is enabled by default?
It's a not expected behavior.
msg208270 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2014-01-16 10:43
Having __debug__ True by default is unintuitive and not particularly useful. However it is relatively well known, so although it is "rarely" used that probably only means hundreds of thousands of piece of code. So it isn't going to change I'm afraid.
History
Date User Action Args
2022-04-11 14:57:57adminsetgithub: 64476
2014-01-16 10:43:13michael.foordsetstatus: open -> closed
resolution: wont fix
messages: + msg208270

stage: resolved
2014-01-16 09:42:48xwildsetmessages: + msg208268
2014-01-16 09:32:51serhiy.storchakasetmessages: + msg208267
2014-01-16 09:20:50xwildsetnosy: + pitrou, ezio.melotti, michael.foord
2014-01-16 09:18:42xwildsetnosy: + serhiy.storchaka
2014-01-16 09:05:29xwildsetversions: - 3rd party
2014-01-16 08:23:25xwildcreate