On 3/21/07, Eric Firing <[EMAIL PROTECTED]> wrote: > Properties would be OK for 2.3; I was thinking we might want to use > them. When a getter and setter already exist, all it takes is the one > extra line of code, plus a suitable (unused) name for the property. I > decided not to pursue traits (if at all) until we can use the Enthought > package as-is. But I think that properties could be converted to traits > very easily if we wanted to do that in the future, so starting with > properties would not be wasted effort. This is getting a bit off-topic, > though.
Minor note: if you are going to use properties, make sure all classes using them are new-style (inherit from object). With old-style classes, properties fail in silent and mysterious ways that may lead to much head-scratching. As far as I can see, it is not currently the case in lines.py (where Line2D inherits from Artist, which is an old-style class). agg.py, which makes extensive use of property(), has it properly wrapped in the following: import types try: _object = types.ObjectType _newclass = 1 except AttributeError: class _object : pass _newclass = 0 del types and then all calls to property() are of the form: if _newclass:x = property(_agg.point_type_x_get, _agg.point_type_x_set) Currently the only two files I see using property() are agg.py and lines.py; once artist.py is fixed to be new-style, things should be fine. And yes, properties are actually OK even with 2.2, so there's no reason to avoid them (and they do provide a nicer, claner user API). Decorators are 2.4-only though. Cheers, f ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel