0

These lines in setup.cfg setup leads to the creation of a script mydemo that will execute the run function of the module __main__:

[options.entry_points]
console_scripts =
    mydemo = mypackage.__main__:run

I would like mydemo to execute run with disabled asserts. Is there a way of doing this ?

4
  • python -O is the only way to disable asserts. See stackoverflow.com/a/56078190/7976758 Found in stackoverflow.com/search?q=%5Bpython%5D+disable+asserts Commented Mar 16, 2022 at 11:53
  • @phd you may be correct, but I find it strange: in practice, this makes assert almost unusable for packaged python software. Commented Mar 22, 2022 at 13:18
  • @phd and also, python -0 could be called by the mydemo script generated by the setuptools. I would not be crazy to imagine that this has been thought of. Commented Mar 22, 2022 at 13:20
  • That explains why asserts have so little usage. BTW it's letter O (from the word "optimize"), not digit 0. Commented Mar 22, 2022 at 13:38

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.