[Python-ideas] incremental hashing in __hash__
Matthias Bussonnier
bussonniermatthias at gmail.com
Fri Dec 30 14:59:33 EST 2016
On Fri, Dec 30, 2016 at 5:24 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
>
> I understood the "iterhash" suggestion to be akin to itertools.accumulate:
>
> >>> for value, tally in enumerate(accumulate(range(10))): print(value, ...
It reminds me of hmac[1]/hashlib[2], with the API : h.update(...)
before a .digest().
It is slightly lower level than a `from_iterable`, but would be a bit
more flexible.
If the API were kept similar things would be easier to remember.
--
M
[1]: https://docs.python.org/3/library/hmac.html#hmac.HMAC.update
[2]: https://docs.python.org/3/library/hashlib-blake2.html#module-hashlib
More information about the Python-ideas
mailing list