What is more efficient?

Gabriel Genellina gagsl-py at yahoo.com.ar
Mon Feb 19 00:15:42 EST 2007


En Mon, 19 Feb 2007 00:17:54 -0300, Karlo Lozovina <_karlo_ at _mosor.net_>  
escribió:

> Let's say I have a class with few string properties and few integers, and
> a lot of methods defined for that class.
>
> Now if I have hundreds of thousands (or even more) of instances of that
> class - is it more efficient to remove those methods and make them
> separate functions, or it doesn't matter?

I'm not sure what you mean, but normal methods are attached to the class,  
not to its instances. It doesn't matter whether you have 0 or a million  
instances, methods do not occupy more memory.

-- 
Gabriel Genellina




More information about the Python-list mailing list