"Alan Isaac" <[EMAIL PROTECTED]> writes:

> I have a class whose instances should only receive attribute
> assignments for attributes that were created at inititialization.
> If slots are not appropriate, what is the Pythonic design for this?

The Pythonic design is: don't expect to have such control over users
of your code. (I encountered this in trying to design an Enum class,
with enumeration members as attributes.)

Document, in the class doc string and anywhere else you feel
appropriate, the fact that attributes shouldn't be added, and let your
users deal with their own bugs if they ignore that.

-- 
 \            "No one ever went broke underestimating the taste of the |
  `\                            American public."  -- Henry L. Mencken |
_o__)                                                                  |
Ben Finney

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

Reply via email to