Adding static typing to Python

Courageous jkraska at
Tue Feb 19 08:42:06 CET 2002

>> One of the things I like about C sharp is their use of attributes,
>> where you can define getters and setters on an attribute, but
>> otherwise the attribute is simply used as if it were a public one.
>> An objects attributes can thereby be used as a published aspect of
>> its interface safely, but no one will be the wiser if you manipulate
>> the getter and setter code.
>Just curious, isn't there something quite similar to what you describe in 

Well, one has been able to roll one's own version of this for a long
time; simply override getattr and settatr and on a per instance basis
do what you need to do. Basically, it's all syntactic sugar. For the
C++ "family" of language, it's quite an innovation, however, as this
is the first time one has been able to use an attribute but get a method
as a consequence.

I don't know if 2.2 offered anything like this. It's not obvious in
the documenation. The docs are in sorry shape, though.


More information about the Python-list mailing list