Python memory optimization question 

Say I have an object class with a function that's many lines long. I would like to instantiate that class thousands of times. How is the function represented in memory? Is it duplicated with each instance or is there only one copy somewhere that gets passed the data for a particular instance upon being called?

@rolltime I don't know for sure, but I would be shocked if it were duplicated with each instance. The only reason I can think of to do that would be to allow editing of each instance's code after instance creation.

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.