On Thu, 15 Nov 2012 17:10:27 -0800, alex23 wrote: > On Nov 16, 3:05 am, Steven D'Aprano <steve > +comp.lang.pyt...@pearwood.info> wrote: >> > ``1/0`` is shorter. ;-) >> >> It is also guaranteed to run, unlike assert. > > Only if they actively pass the command line switch to turn it off,
Not necessarily "actively". On Linux you can set up command aliases, e.g. `alias python=python -O` and I dare say there is some equivalent under Windows. Once you have done so (which could be many months in the past, and forgotten about) you no longer need to actively specify -O to run with optimization on. > which > I'd assume someone intentionally using an assertion wouldn't do. Provided that they know the side-effect of -O, and that the code contains an assertion. Not all code is executed by the same person who wrote it, and not all people remember every fine detail about every script they wrote. I couldn't possibly tell you what all my scripts do without checking the source code. -- Steven -- http://mail.python.org/mailman/listinfo/python-list