[docs] [issue11908] Weird `slice.stop or sys.maxint`

Raymond Hettinger report at bugs.python.org
Sun Dec 2 18:18:40 CET 2012


Raymond Hettinger added the comment:

ysj:  The "equivalent" means "roughly equivalent" not "precisely equivalent".  The purpose of the code in the docs is to help communicate what islice() is all about.  Practicality beats purity in this regard.  I know of no one who has ever been mislead by the islice() docs.

I don't really like the proposed patch -- it improves a bit on technical accuracy but forgoes readability and still falls short on what stop=None does and on which arguments are required.  

That said, I don't really like the current version of the "roughly equivalent code either".  It should probably be rewritten completely (no longer using slice() and it should show the actual looping logic.  For clarity, it may be helpful to split it into two code-equivalents, one for the finite case (where stop is specified) and one for the infinite case (where stop is None).  

As it stands, the examples are beating the code equivalent when it comes to communicating what islice() does.  I don't want to lengthen the code fragment unless it becomes *both* more communicative and more accurate.

----------

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


More information about the docs mailing list