Marco Pesenti Gritti wrote: >> For simple public data attributes, it is best to expose just the >> attribute name, without complicated accessor/mutator methods > > I'm not sure I like this... It's quite unusual for non python coders. > If we want to keep it we should probably elaborate more on it in the > guide.
Unusual, but definitely idiomatic Python; there's just no need for getters/setters on simple public members. If you need to replace a member with a function later, you can do so without breaking existing code. > With this method, how do you find out which attributes are supported > other than by reading the code? Is there a way to document them? It depends whether it's a program or a human doing the finding. For humans, you can insert a helpful docstring in the class explaining what each member holds. Within a program, you can make use of introspection to peek inside an object and discover its members. -- Ivan Krstić <[EMAIL PROTECTED]> | GPG: 0x147C722D _______________________________________________ Sugar mailing list [email protected] http://mailman.laptop.org/mailman/listinfo/sugar
