Hi all, Thanks for your insightful answers, and a merry Christmas + a happy new year!
Btw, somebody on the list mentioned rpy as an alternative way to create spider charts. I also think that's a better route to take. R is thoroughly tested and built for the job, and if you ever need more statistical/plotting things, you could easily extend your program. Cheers!! Albert-Jan ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In the face of ambiguity, refuse the temptation to guess. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- On Thu, 12/24/09, Kent Johnson <[email protected]> wrote: From: Kent Johnson <[email protected]> Subject: Re: [Tutor] python and kiviat diagrams To: "Albert-Jan Roskam" <[email protected]> Cc: "dwbarne" <[email protected]>, "python tutor" <[email protected]> Date: Thursday, December 24, 2009, 2:19 PM On Wed, Dec 23, 2009 at 5:27 PM, Albert-Jan Roskam <[email protected]> wrote: > > I was studying the code on > http://matplotlib.sourceforge.net/examples/api/radar_chart.html. > Isn't it very unusual that a class is defined within a function? Unusual, but not un-heard of. Usually the function is a factory function that returns the class to the caller. In this case the class is registered as the handler for projections of type 'radar'. Presumably RadarAxes is implementing a protocol (interface) that is required by register_projection(). > Why not use a class instance inside the function instead? Presumably register_projection() requires a class (strictly speaking, it probably requires a callable that returns an instance of a class that implements the required protocol). There don't seem to be any docs for register_projection() so it's hard to know for sure what it wants. > No methods of the class can currently be inherited outside the scope of the > function, right? Do you mean, the class cannot be subclassed? Not easily, only because the function doesn't return the class. There is no inherent reason this class could not be subclassed if a reference to the class were available. Kent
_______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
