John Hunter wrote:
>>>>>> "Eric" == Eric Firing <[EMAIL PROTECTED]> writes:
> 
>     Eric> I can continue making the necessary changes if that is OK
>     Eric> with you, but I don't want our versions to get tangled up if
>     Eric> you are still working on this aspect, or if you don't like
>     Eric> the strategy modification outlined above.  I committed
>     Eric> dedent but not the other changes.
> 
> This looks very good and a definite improvement.  You might consider
> extending this a bit to have a custom class that handles all the
> details.  The general sketch is

Very nice.  I thought about making a standalone expand_doc() function, 
but your incorporation of it in the class is much nicer.  I think I will 
put this on the stack and not do it immediately.  I already made all the 
changes I outlined (couldn't stop once I got going) and can't quite face 
another pass through the files right now.

But in the process of making that pass, I ran into a small worm can:  in 
the collections the kwargs and the setters don't match, so 
kwdocd['PatchCollection'], for example, is not quite right.  The 
collection setter names are singular (set_color) to mirror the 
corresponding non-collection objects, but the kwargs are plural 
(colors).  Although I see the (grammatical) logic of the plural form I 
like the singular form because I see little gain and considerable loss 
in having different names for the same functionality in LineCollection 
as compared to Line2D, for example.  We could get around the problem by 
allowing the singular forms of the kwargs as well and deprecating the 
plural forms.

Another small glitch: it looks like you used the inspector to assemble 
the kwargs list for the Axes docstring, but some of these, like figure 
and position, duplicate required arguments so they don't really makes 
sense as kwargs--even though they would work.  Did you edit out other 
such examples?  Is that the reason the Axes.__init__ kwargs list is not 
being generated automatically?

Eric

> 
> class Kwdocd(dict):
> 
>     def inspect(self, artist):
>         # add artist to kwdocd, using __name__ or __class__ to get the key
> 
>     def expand_doc(self, method):
>         # interpolate kwdocd into method.__doc__ altering
>         # method.__doc__ in place
> 
> kwdocd = Kwdocd()
> 
> and then we have
> 
> class Line2D:
>     pass
> 
> kwdocd.inspect(Line2D)
> 
> class Axes:
>     def plot(self, *args, **kwargs):
>         """
>          %(Line2D)s
>         """
>         pass
>     kwdocd.expand_doc(plot)
> 
> 
> This is untested but it is consistent with the work you've done so far
> to simplify the API at the level of the derived Artist classes by
> hiding the gory details.
> 
> JDH


-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to