Unfortunate exception on dict item assignment (and why aren't slices hashable?)
Aahz
aahz at pythoncraft.com
Mon Jul 28 22:25:17 EDT 2003
In article <mailman.1058757391.658.python-list at python.org>,
Jeff Epler <jepler at unpythonic.net> wrote:
>
>I don't see what's problematic about letting slices be hashable: they
>don't appear to be mutable, for instance.
>>>> s.start
>0
>>>> s.start = -1
>TypeError: readonly attribute
>... it may merely be an oversight. Hashing them as
> hash((s.start,s.stop,s.step))
>might be a reasonable definition.
Makes sense to me. Feel free to submit a patch to SF. ;-)
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
This is Python. We don't care much about theory, except where it intersects
with useful practice. --Aahz
More information about the Python-list
mailing list