What is a function parameter =[] for?

Chris Angelico rosuav at gmail.com
Thu Nov 26 06:24:44 EST 2015


On Thu, Nov 26, 2015 at 10:12 PM, Dave Farrance <df at see.replyto.invalid> wrote:
> Marko Rauhamaa <marko at pacujo.net> wrote:
>
>>Dave Farrance <df at see.replyto.invalid>:
>>
>>> (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".)
>>
>>What's a faked id?
>
> You can figure out what I'm getting at -- i.e. I presume that the ids
> are not pointers to stored numbers in memory (as with CPython) but are a
> translation of the numerical variable's value.

As long as they're unique among concurrently-existing objects, that's
fully compliant and not at all invalid. It might be generated in some
way from its value, but that's safe as long as there's a scheme that
keeps all other objects away from them.

ChrisA



More information about the Python-list mailing list