On 03/07/15 01:39, Jim Mooney Py3.4.3winXP wrote:
Okay, it appears the method in a class has its own ID, but all
instantiations of that method have identical IDs. But what happens if we
have a huge number of instantiations trying to access the identical method
at the same time?
They all execute the method.
Its no different to a global function. What happens if lots
of objects, or even threads, access a global function? They
all execute the same code, each within their own environment.
It's the same with methods.
I'm not sure why you think there would be an issue?
One issue that may be confusing things is when you say
"at the same time". Now in principle they could all be running
concurrently since they never modify the function they only
"read" it but in practice CPython serializes those calls
anyway so only one call is active at any one time. But
there is no real reason why that should be the case.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor