In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Alex Martelli) wrote:

> > One other question I did not get answered:  is there any
> > simple example of a Pythonic use of __slots__ that does NOT
> > involve the creation of **many** instances.
> 
> Since the only benefit of __slots__ is saving a few bytes per instance,
> it's not worth the bother unless there are many instances -- so, the
> answer is 'no'.

I can think of at least two other benefits to using __slots__:

1.  If you have a typo in an attribute assignment you get an exception 
instead of a latent downstream bug.

2.  Implicit documentation.

rg
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to