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

Maciej Fijalkowski fijall at gmail.com
Sun Nov 17 22:05:07 CET 2013


On Sun, Nov 17, 2013 at 9:02 PM, Barry Warsaw <barry at python.org> wrote:
> On Nov 17, 2013, at 05:14 PM, Victor Stinner wrote:
>
>>2013/11/16 Maciej Fijalkowski <fijall at gmail.com>:
>>> Can I see some writeup how -OO benefit embedded devices?
>>
>>You get smaller .pyc files. In an embedded device, the whole OS may be
>>written in a small memory, something like 64 MB or smaller. Removing
>>doctrings help to fit in 64 MB.
>
> I'm in support of separate flags for stripping docstrings and asserts.  I'd
> even be fine with eliminating a flag to strip docstrings if we had a
> post-processing tool that you could apply to pyc files to strip out the
> docstrings.  Another problem that I had while addressing these options in
> Debian was the use of .pyo for both -O and -OO level.
>
> -Barry
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/fijall%40gmail.com

My problem with -O and -OO is that their arguments are very circular.
Indeed, I understand the need why you would want in certain and
limited cases to remove both docstrings and asserts. So some options
for doing so are ok. But a lot of arguments I see are along the lines
of "don't use asserts because -O removes them". If the option was
named --remove-asserts, noone would care, but people care since -O is
documented as "do optimizations" and people *assume* this is what it
does (makes code faster) and as unintended consequence removes
asserts.

Cheers,
fijal


More information about the Python-Dev mailing list