Newbie Q: Class Privacy (or lack of)

Diez B. Roggisch deets at nospam.web.de
Wed Aug 2 12:10:22 EDT 2006


> I find that a strange purpose because when you are working on a class,
> you don't necessarily know if you will ever know many instance of that
> class. So should I use __slots__ in all my classes, just to be sure
> for when someone wants many instances of one?
 
I find that a strange reasoning because when you are working on a class,
you don't necessarily know if you will ever know if it needs a
__getitem__-method.
So do you use __getitem__ in all your classes, just to be sure
for when someone wants __getitem__ in one?

To my experience programming often means that requirements change - and one
has to adapt. If memory becomes an issue, you might overcome it using
slots. Or a disk cache. Or buy new memory. Does that imply for you that you
buy new disks and memory each time you start coding?

Diez




More information about the Python-list mailing list