Autrijus Tang <[EMAIL PROTECTED]> wrote:

> What does unboxed values return for their "id", though?

>     3 =:= 3;      # always true?
>     3.id ~~ 3.id;   # ditto?

Maybe true or not, that's highly implementation dependent. I'd not touch
these internals:

$ python
Python 2.4 [...]

>>> id(2) == id(1+1)
True
>>> id(200) == id(100+100)
False
>>> hash(2) == hash(1+1)
True
>>> hash(200) == hash(100+100)
True
>>>
>>> id(-5)==id(-2-3)
True
>>> id(-6)==id(-3-3)
False

Parrot could also cache small integers like Python does but it's by far
too early to dig into that.

If we want some interoperbility with Python dicts, hashing will not be
done on ids but on the hash function of the type.

> Thanks,
> /Autrijus/

leo

Reply via email to