Getters and Setters
Neel Krishnaswami
neelk at brick.cswv.com
Thu Jul 15 19:35:38 EDT 1999
More information about the Python-list mailing list
Thu Jul 15 19:35:38 EDT 1999
- Previous message (by thread): Getters and Setters
- Next message (by thread): Getters and Setters
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
In article <000701bece99$6dbeede0$51a22299 at tim>, Tim Peters <tim_one at email.msn.com> wrote: >[Neil Schemenauer] >> For those who are not familiar, CLOS (and Dylan) create a "getter" >> and "setter" method for each attribute of a class. This saves the >> programmer from writing "getX" and "setX" for every attribute when >> no special action is needed. Later, an explict method can be created >> if needed. > >Python goes one better: you can write an explicit method if needed, but it >doesn't encourage bad practice by automatically supplying methods that >expose every data attribute, crying "use me! abuse me!" <wink>. Be fair, now -- Dylan doesn't try to do data hiding in the class definition; it uses module export lists to determine what is visible to users of the module. This isn't any worse that Python's leading- underscore convention for data hiding. Besides, Dylan has syntactically-significant whitespace just like Python does, so it has to be a good language, right? :) Neel
- Previous message (by thread): Getters and Setters
- Next message (by thread): Getters and Setters
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list