Declarative properties

Paul Hankin paul.hankin at
Thu Oct 11 21:02:25 CEST 2007

On Oct 11, 7:42 pm, Marc 'BlackJack' Rintsch <bj_... at> wrote:
> Sorry I don't get it.  If I want to customize the access to a "normal"
> attribute I simply turn it into a property.

I *think* I understand Artur's problem: he wants to be able to add
(for example) clean-up and validation code to public accesses of these
attributes, but he doesn't want this code run internally to the class.
Or another way of saying the same thing: he wants two views of a
variable; one internal to the class, another to the public.

If I understand correctly, his plan is to use 'X._name' internally to
code in his class, but the public uses ''. Initially, one is an
alias for the other, but later he writes getters and setters to
customise access through the public version.

[I could be totally wrong of course]
Paul Hankin

More information about the Python-list mailing list