[New-bugs-announce] [issue11908] Weird `slice.stop or sys.maxint`

Ram Rachum report at bugs.python.org
Fri Apr 22 19:37:26 CEST 2011


New submission from Ram Rachum <cool-rr at cool-rr.com>:

In the documentation for `itertools.islice` I see this line:

    it = iter(xrange(s.start or 0, s.stop or sys.maxint, s.step or 1))

Is it really okay to do `s.stop or sys.maxint`? I'm assuming this was targeting `None`, but what if `s.stop == 0`? And `s.step` could (pathologically) be `0` too, no?

----------
assignee: docs at python
components: Documentation
messages: 134276
nosy: cool-RR, docs at python
priority: normal
severity: normal
status: open
title: Weird `slice.stop or sys.maxint`
type: behavior
versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4

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


More information about the New-bugs-announce mailing list