Re: proposal for slice hashing

2020-05-16 Thread Will Bradshaw
On Tuesday, May 12, 2020 at 5:51:37 PM UTC-4, Paul Rubin wrote: > Terry Reedy writes: > > Slice objects are similar to named tuples > > In that case making them hashable sounds like good sense. I mean I've already made and tested a patch it wasn't hard. I did same day as I made the post. I've a

Re: proposal for slice hashing

2020-05-12 Thread Terry Reedy
On 5/11/2020 3:58 PM, Will Bradshaw wrote: I recently ran into a situation where I needed to hash a slice and found this to be unsupported. Slice objects, as opposed to slices of objects, have no explicit use in Python itself. They were added for use by "NumericalPython and other 3rd party e

Re: proposal for slice hashing

2020-05-11 Thread Will Bradshaw
On Monday, May 11, 2020 at 4:45:55 PM UTC-4, Chris Angelico wrote: > On Tue, May 12, 2020 at 6:31 AM Will Bradshaw wrote: > > > > On Monday, May 11, 2020 at 4:10:56 PM UTC-4, Chris Angelico wrote: > > > On Tue, May 12, 2020 at 6:01 AM Will Bradshaw > > > wrote: > > > > The only options as of now

Re: proposal for slice hashing

2020-05-11 Thread Chris Angelico
On Tue, May 12, 2020 at 6:31 AM Will Bradshaw wrote: > > On Monday, May 11, 2020 at 4:10:56 PM UTC-4, Chris Angelico wrote: > > On Tue, May 12, 2020 at 6:01 AM Will Bradshaw > > wrote: > > > The only options as of now are: > > > 1. use 3 layers of wrappers to pack the slices into a custom ty

Re: proposal for slice hashing

2020-05-11 Thread Will Bradshaw
On Monday, May 11, 2020 at 4:10:56 PM UTC-4, Chris Angelico wrote: > On Tue, May 12, 2020 at 6:01 AM Will Bradshaw wrote: > > The only options as of now are: > > 1. use 3 layers of wrappers to pack the slices into a custom type that > > supports hashing pass this mangled version of the argume

Re: proposal for slice hashing

2020-05-11 Thread Chris Angelico
On Tue, May 12, 2020 at 6:01 AM Will Bradshaw wrote: > The only options as of now are: > 1. use 3 layers of wrappers to pack the slices into a custom type that > supports hashing pass this mangled version of the arguments through lru_cache > wrapper into a function that reverses the process

proposal for slice hashing

2020-05-11 Thread Will Bradshaw
I recently ran into a situation where I needed to hash a slice and found this to be unsupported. This seems silly as there is little benefit of slices not supporting hashing and large downsides. This coupled with the fact that one cannot subclass slices is a significant and needless annoyance.