From: Antony L. <ant...@be...> - 2013-02-08 01:40:53
|
Hi, I saw that a discussion started on transitioning to the use of properties instead of explicit getters and setters, which seems like a very good idea to me... so I thought this would be a good idea to get involved in matplotlib-devel :) Right now an issue raised is what to do with set_* that take multiple arguments. Taking set_title, which takes both positional and keyword arguments, as an example, my idea would be to do ax.title = "A title" ax.title.fontdict = fontdict Basically, a property "foo" (in the matplotlib meaning of the word) becomes a descriptor with __get__ => get_foo and __set__ => set_foo, and keyword arguments to the old property setter become themselves descriptors on that descriptor. Antony |