[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. pinning-the-blame-is-90%-of-debugging-and-"assert"-should-pin-it- exactly-ly y'rs - tim
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4