Author christian.heimes
Recipients BTaskaya, Mark.Shannon, christian.heimes, mark.dickinson, pablogsal, rhettinger, serhiy.storchaka
Date 2020-11-24.18:07:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1606241270.35.0.234482115511.issue42454@roundup.psfhosted.org>
In-reply-to
Content
I'm slightly concerned about hashability of slice objects. Currently the slice constructor does not ensure that any slice parameter is a number. You can do horrible stuff like this:

>>> slice({})
slice(None, {}, None)

which of course fails later on:

>>> [][slice({})]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: slice indices must be integers or None or have an __index__ method

Would it be possible to move type checks to slice constructor?
History
Date User Action Args
2020-11-24 18:07:50christian.heimessetrecipients: + christian.heimes, rhettinger, mark.dickinson, Mark.Shannon, serhiy.storchaka, pablogsal, BTaskaya
2020-11-24 18:07:50christian.heimessetmessageid: <1606241270.35.0.234482115511.issue42454@roundup.psfhosted.org>
2020-11-24 18:07:50christian.heimeslinkissue42454 messages
2020-11-24 18:07:50christian.heimescreate