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 <rep...@bugs.python.org>
<http://bugs.python.org/issue11908>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to