Yes, I realize that this (or the += approach) was overdoing it.  Separating
the stuff in two different properties is probably more the way to go (at
least, it's less crazy).

Even the ax.title += (string, options) approach has the problem that this
would imply ax.title (in the sense of ax.__dict__["title"].__get__(ax))
cannot be a string anymore, so this would involve some wrapper object.  Ugh.

Antony

2013/2/8 Todd <toddr...@gmail.com>

> On Fri, Feb 8, 2013 at 2:40 AM, Antony Lee <antony....@berkeley.edu>wrote:
>
>> 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
>>
>>
> I think this makes it over-complicated.  It is much simpler, more
> explicit, and more consistent to have two properties here, one that only
> deals with a string, and a second that only deals with a text object.  Then
> you can do something like (where titletext returns the text object):
>
> ax.titletext.fontdict
>
> That way we automatically get what you want without any additional work or
> fancy tricks in a much cleaner, more explicit, and more predictable manner.
>
>
>
> ------------------------------------------------------------------------------
> Free Next-Gen Firewall Hardware Offer
> Buy your Sophos next-gen firewall before the end March 2013
> and get the hardware for free! Learn more.
> http://p.sf.net/sfu/sophos-d2d-feb
> _______________________________________________
> Matplotlib-devel mailing list
> Matplotlib-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
>
>
------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to