[Tutor] __slots__

Mike Hansen mhansen at cso.atmel.com
Thu Oct 13 15:44:46 CEST 2005

> Subject:
> Re: [Tutor] __slots__
> From:
> Kent Johnson <kent37 at tds.net>
> Date:
> Wed, 12 Oct 2005 18:22:46 -0400
> CC:
> Python Tutor Mailing List <tutor at python.org>
> Liam Clarke wrote:
>> Well, all I can say is, don't use them unless you need them, they're a
>> lot of hassle.
> 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? 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.


More information about the Tutor mailing list