This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2003年09月04日 23:46 by fleiter, last changed 2022年04月10日 16:11 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg18062 - (view) | Author: Stefan Fleiter (fleiter) | Date: 2003年09月04日 23:46 | |
Raymond told me in comp.lang.python to submit this bug, he is working on a fix. >>> s = slice(None,5) >>> s.__hash__() 136748064 >>> hash(s) Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: unhashable type |
|||
| msg18063 - (view) | Author: Stefan Fleiter (fleiter) | Date: 2003年09月04日 23:52 | |
Logged In: YES user_id=502578 Terry J. Reedy commented in comp.lang.python: ------------------------------------------------------------------------- Ref Manual 5.3.3 Slicings says nothing about hashability. If not hashable, in spite of being mutable, "Slices are not hashable" could be added at end. Ref Manual 3.3.1 Basic customization, __hash__( self) entry says "Called for the key object for dictionary operations, and by the built-in function hash() " This implies to me that if there is a __hash__() method, then hash() will call it. If not true, then a 'maybe' could be added. Lif Maual 2.1 Built-in Functions, hash( object) says only "Return the hash value of the object (if it has one)." If having __hash__() does not mean 'has one', then what does. |
|||
| msg18064 - (view) | Author: Raymond Hettinger (rhettinger) * (Python committer) | Date: 2003年09月05日 14:40 | |
Logged In: YES user_id=80475 Fixed. Now, they both raise TypeError. See Objects/sliceobject.c 2.21.16.1 and 2.22. Thanks for the bug report. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月10日 16:11:00 | admin | set | github: 39183 |
| 2003年09月04日 23:46:29 | fleiter | create | |