How to restrict settable attributes for an object?
Laotseu
bdesth at free.fr
Wed Oct 9 11:36:35 EDT 2002
Alex Moffat <ajm_NO_REPLY_ at zanthan.com> wrote in message news:<MeMo9.90$TY5.86178 at dca1-nnrp2.news.algx.net>...
> What I want to do is restrict the attributes that can be set on an
> object. I want to do this for "data objects" so that I can catch typing
> errors in my program and more easily manage sql interfacing. My current
> "solution" is pasted below. Is there a better technique that I should
> use. I'm new to python so I'd like to try and follow the established
> idioms and patterns where they exist.
>
[snip code]
Depending on the version of python you're using, you could use slots.
They provide the same functionnality as the one you implemented.
laotseu
More information about the Python-list
mailing list