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

Nick Coghlan ncoghlan at gmail.com
Sat Nov 16 17:08:14 CET 2013


On 17 November 2013 01:46, Antoine Pitrou <solipsis at pitrou.net> wrote:
> I agree that conflating the two doesn't help the discussion.
> While removing docstrings may be beneficial on memory-constrained
> devices, I can't remember a single situation where I've wanted to
> remove asserts on a production system.

While I actually agree that having separate flags for --omit-debug,
--omit-asserts and --omit-docstrings would make more sense than the
current optimization levels, Maciej first proposed killing off -OO
(where the most significant effect is removing docstrings which can
result in substantial program footprint reductions for embedded
systems), and only later switched to asking about removing asserts
(part of -O, which also removes blocks guarded by "if __debug__", both
of which help embedded systems preserve precious ROM space, although
to a lesser degree than removing docstrings can save RAM).

One of the most important questions to ask when proposing the removal
of something is "What replacement are we offering for those users that
actually need (or even just think they need) this feature?". Sometimes
the answer is "Nothing", sometimes it's something that only covers a
subset of previous use cases, and sometimes it's a complete functional
equivalent with an improved spelling. But not asking the question at
all (or, worse, dismissing the concerns of affected users as
irrelevant and uninteresting) is a guaranteed way to annoy the very
people that actually rely on the feature that is up for removal or
replacement, when you *really* want them engaged and clearly
explaining their use cases.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list