[Python-Dev] CVS: python/dist/src/Lib/xml/dom minidom.py,1.13,1.14

Tim Peters tim.one@home.com
Tue, 21 Nov 2000 18:09:39 -0500

[Andrew Kuchling]
> Indeed; I think the proxies really obfuscated the code.  Some
> simple parameter checking, though, shouldn't add too much of a
> burden, and will protect users from common mistakes that will
> result in invalid trees.

[Paul Prescod]
> Those checks would slow down the original tree building unless
> we split the interface into "internal" methods that we use
> ourself and "external methods" that do the extra checking. Worth
> the effort and extra code complexity? Maybe...maybe not.

[Jeremy Hylton]
> Could those checks be implemented as assertions?  If so, people who
> care about speed can use "python -O"

[Greg Stein]
> +1 ... that would be the way to do it.

-1.  User input is never trustworthy.  Your and your users' software lives
will be a lot happier if you stick to the rule that an assertion failure
always (always!) announces a bug in the implementation -- assertion failure
is never a user's fault.  This makes assertions *possibly* suitable for
Paul's hypothesized "internal methods", but never for checking that
user-supplied arguments satisfy preconditions.

    exactly-ly y'rs  - tim