Newbie: Why doesn't this work

petr.jakes.tpc at gmail.com petr.jakes.tpc at gmail.com
Tue Jan 1 16:01:24 EST 2008


> > My question is: is it possible to set the "property" for any attribute
> > when I do not know what will be the name of the attribute in the
> > future?
>
> Uhm... I don't understand the question. Perhaps if you think of a concrete
> case...?

Thanks for reply,

few minutes after i posted my question, I have realized my posting is
probably a "nonsense".

If I understand it properly, it is necessary, in the respect of
encapsulation, to define attributes inside the class (even it is
possible to add a new attribute to the existing object outside class
definition).

The meaning of my question was:
Is it possible to define some general sort of set/get/del/doc rules
for the attributes which are defined in the code AFTER the
instantiation of an object.

I am sending this question even I feel such a "on the fly" creation of
the attribute is probably not a good trick.

Petr Jakes



More information about the Python-list mailing list