Re: [Python-ideas] incremental hashing in __hash__

2016-12-29 Thread Steven D'Aprano
On Wed, Dec 28, 2016 at 12:44:55PM -0500, [email protected] wrote: > On Wed, Dec 28, 2016 at 12:10 PM, Ethan Furman wrote: > > > In other words, objects that do not compare equal can also have the same > > hash value (although too much of that will reduce the efficiency of > > Python's containe

Re: [Python-ideas] incremental hashing in __hash__

2016-12-29 Thread Chris Angelico
On Thu, Dec 29, 2016 at 7:20 PM, Steven D'Aprano wrote: > I'd rather add a generator to the itertools > module: > > itertools.iterhash(iterable) # yield incremental hashes > > or, copying the API of itertools.chain, add a method to hash: > > hash.from_iterable(iterable) # return hash cal

Re: [Python-ideas] New PyThread_tss_ C-API for CPython

2016-12-29 Thread Erik Bray
On Wed, Dec 21, 2016 at 5:07 PM, Nick Coghlan wrote: > On 21 December 2016 at 20:01, Erik Bray wrote: >> >> On Wed, Dec 21, 2016 at 2:10 AM, Nick Coghlan wrote: >> > Option 2: Similar to option 1, but using a custom type alias, rather >> > than >> > using a C99 bool directly >> > >> > The closes

Re: [Python-ideas] incremental hashing in __hash__

2016-12-29 Thread jab
Thanks for the thoughtful discussion, it's been very interesting. Hash algorithms seem particularly sensitive and tricky to get right, with a great deal of research going into choices of constants, etc. and lots of gotchas. So it seemed worth asking about. If I had to bet on whether repeatedly acc

Re: [Python-ideas] incremental hashing in __hash__

2016-12-29 Thread Tim Delaney
On 29 December 2016 at 19:20, Steven D'Aprano wrote: > > With respect Josh, I feel that this thread is based on premature > optimization. It seems to me that you're *assuming* that anything less > than some theoretically ideal O(1) space O(N) time hash function is > clearly and obviously unsuitab