What is a function parameter =[] for?

Random832 random832 at fastmail.com
Thu Nov 26 23:33:53 EST 2015


Steven D'Aprano <steve at pearwood.info> writes:

> On Thu, 26 Nov 2015 09:34 pm, Dave Farrance wrote:
>
>
>> (Conversely, I see that unlike CPython, all PyPy's numbers have
>> unchanging ids, even after exiting PyPy and restarting, so it seems that
>> PyPy's numerical ids are "faked".)
>> 
>> [PyPy 2.6.1 with GCC 4.9.2] on linux2
>>>>>> id(1+2j)
>> 679900119843984469027190799480815353863L
>> 
>> [PyPy 2.6.1 with GCC 4.9.2] on linux2
>>>>>> id(1+2j)
>> 679900119843984469027190799480815353863L
>
>
> I'm pretty sure that they are faked.

The hex value may be instructive:

0x1ff800000000000020000000000000007L

That's 0x3ff00000000000004000000000000000 << 3 | 7.

3ff000... is the double representation of 1, 400000... is 2.

I bet that that three-bit field at the end has different values for all
the different types they are "faked" for, and one for the ones that
they're "not faked".




More information about the Python-list mailing list