Adding static typing to Python

Courageous jkraska at san.rr.com
Tue Feb 19 01:45:10 EST 2002


>> Python also lacks features of "data hiding", it attempts to provide
>> some support for it but only in a desultory "procedural" way - try
>> this with 40 programmers and you won't get far! :-)
>
>This is silly - let me guess, ...

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.

This has to be one of the best ideas I've seen in encapsulation in
quite some time. It's encapsulated, but it isn't. It's syntactically
compact, but can be used to do a significant job.



C//




More information about the Python-list mailing list