how set/change env var PYTHONOPTIMIZE in Python 3 / 3.7 / 3.8 ???? - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: how set/change env var PYTHONOPTIMIZE in Python 3 / 3.7 / 3.8 ???? (/thread-28763.html) |
how set/change env var PYTHONOPTIMIZE in Python 3 / 3.7 / 3.8 ???? - lsepolis123 - Aug-02-2020 how set/change env var PYTHONOPTIMIZE in Python 3 / 3.7 / 3.8 ???? I want to skip assertion... how? a = input("enter a number: ") assert int(a) > 0 or int(a) < 0, "a is zero" # also a != 0 # https://docs.python.org/3/using/cmdline.html#envvar-PYTHONOPTIMIZE """ PYTHONOPTIMIZE If this is set to a non-empty string it is equivalent to specifying the -O option. If set to an integer, it is equivalent to specifying -O multiple times. """ RE: how set/change env var PYTHONOPTIMIZE in Python 3 / 3.7 / 3.8 ???? - Gribouillis - Aug-02-2020 You can change it like any environment variable in your OS (which is?) That said, why not simply run python with the -O option? RE: how set/change env var PYTHONOPTIMIZE in Python 3 / 3.7 / 3.8 ???? - lsepolis123 - Aug-03-2020 (Aug-02-2020, 04:12 PM)Gribouillis Wrote: You can change it like any environment variable in your OS (which is?) That said, why not simply run python with the -O option? when you say: That said, why not simply run python with the -O option What do you mean in Python IDLE or Thonny Python Editor? When running/executing the file.py... how? Please give an example RE: how set/change env var PYTHONOPTIMIZE in Python 3 / 3.7 / 3.8 ???? - Gribouillis - Aug-03-2020 With IDLE in python 3.8 it works for me if I open IDLE with the -O switch on the command line It seems that idle propagates the -O flag to the scripts that it runs.With Thonny, it didn't work with the -O flag, but it worked with this command line (in linux)
RE: how set/change env var PYTHONOPTIMIZE in Python 3 / 3.7 / 3.8 ???? - lsepolis123 - Aug-03-2020 idlelib WIN 10 --- HOW find where IDLE installed ??? This PYTHONOPTIMIZE=1 can be set as Windows env var??? |