[pypy-dev] hash negotiation
Armin Rigo
arigo at tunes.org
Mon Mar 3 17:43:59 CET 2003
Hello Christian,
More about Laura's comments in a next e-mail. Just a couple of pragmatic
answers:
On Sat, Mar 01, 2003 at 08:01:18PM +0100, Christian Tismer wrote:
> It may negotiable whether we want to preserve an extra flag
> in all the hashable objects whether the hash has been computed,
> or repeat CPython's way to preserve a single value for this.
This abuse of -1 was for error passing, and we don't need it, so I thought it
should just go away. My point of view is definitely that any "C hack" should
go away.
For objects like strings that internally use -1 for yet another usage ("not
computed yet"), our W_StringObjects are free to repeat that and never actually
return a value of -1. That's fine.
Regarding CPython compatibility, that can be added later if needed by keeping
an explicit track of this kind of changes (hence the XXX in my comments -- but
we certainly need a better way to sort this kind of comments). It might be as
simple as calling our own hash functions, and then, if that returns -1,
translate it into -2 (as this is how all CPython objects work around this
special value).
Well, again the best solution is probably to have a doc repository for this
kind of issues.
A bientot,
Armin.
More information about the Pypy-dev
mailing list