Mike Hansen wrote: >>From: >>Kent Johnson <[EMAIL PROTECTED]> >>I think the conventional advice is something like, if you don't >>understand why using slots is a bad idea, you have no business using >>them :-) >> > Can you tell us the pros and cons of using slots?
I think I am in the group of people who have no business using __slots__ ;-) What I gather from discussions on comp.lang.python is that really the only good reason for using __slots__ is for the memory optimization when you have huge numbers of objects instantiated. There are quite a few gotchas in the docs and more discussed in c.l.p. Search c.l.p for __slots__ to find discussion... Kent > Although I haven't used them > yet, they seem like a way to lock down a class so you don't accidentally add > new > attributes to that class. (emp.name vs emp.nmae) Might be handy when working > on > a team too. Although something like Pychecker would most likely catch those > accidents. <shrug> I dunno. > > Mike > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor