[issue28397] Faster index range checks

Raymond Hettinger report at bugs.python.org
Sun Oct 9 22:17:39 EDT 2016


Raymond Hettinger added the comment:

Don't change the code in the collections module.  While semantically valid, the change obfuscates the code.  The meaning of maxlen < 0 is that there is no maximum length.  I don't want this test hidden; otherwise, I would have changed it long ago as was done elsewhere in the module where it made sense.

Elsewhere, consider making a macro with clear name and comment (as was done with NEEDS_TRIM) in the collections module.  Otherwise, you're just leaving behind constipated and tricky code with no indication of why a signed variable is being coerced to unsigned.

----------
nosy: +rhettinger

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28397>
_______________________________________


More information about the Python-bugs-list mailing list