why does id(multiprocessing.Process.start) == id(multiprocessing.Process.start)?

random832 at fastmail.us random832 at fastmail.us
Tue Aug 18 00:11:59 EDT 2015


On Mon, Aug 17, 2015, at 18:25, alex.flint at gmail.com wrote:
> Sorry I completely mistype that. It was supposed to read:
> 
> >>> id(multiprocessing.Process.is_alive) == id(multiprocessing.Process.start)
> True
> 
> >>> multiprocessing.Process.is_alive is multiprocessing.Process.start
> False

Try this:
is_alive = multiprocessing.Process.is_alive
start = multiprocessing.Process.start
id(is_alive) == id(start)

If (as I believe it will) this ends up being false, this shows that it's
an issue of object lifespan with the values of the expression being
temporary method wrappers. From some testing, on my machine on CPython
2.7 this appears to work for any method of any class written in python.
While you fixed the typo, it is instructive to note that, as in your
original example, multiprocessing.Process.start is
multiprocessing.Process.start is *also* False, which would not be the
case if the method wrapper were a permanent object.



More information about the Python-list mailing list