Strategies for controling attribute assignment

Dale Strickland-Clark dale at riverhall.NOSPAMco.uk
Tue Oct 2 08:01:59 EDT 2001


A 'properly' encapsulated business class tends to involve methods and
attributes. However, managing attribute assignment gets very messy
with __setattr__ as you need to devise a scheme to distinguish class
attributes and working instance variables.

Often, externally visible class attributes need to be validated and
instance variables don't. Or they may get stored elsewhere.

What strategies have people come up with to manage this distinction
without bogging the code down in excessive checks.

I would really like a way to distinguish between these two without
having to check dictionaries.

Thanks.
--
Dale Strickland-Clark
Riverhall Systems Ltd



More information about the Python-list mailing list