[Tutor] python and kiviat diagrams

Albert-Jan Roskam fomcl at yahoo.com
Fri Dec 25 13:53:37 CET 2009

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.




In the face of ambiguity, refuse the temptation to guess.


--- On Thu, 12/24/09, Kent Johnson <kent37 at tds.net> wrote:

From: Kent Johnson <kent37 at tds.net>
Subject: Re: [Tutor] python and kiviat diagrams
To: "Albert-Jan Roskam" <fomcl at yahoo.com>
Cc: "dwbarne" <dwbarne at earthlink.net>, "python tutor" <tutor at python.org>
Date: Thursday, December 24, 2009, 2:19 PM

On Wed, Dec 23, 2009 at 5:27 PM, Albert-Jan Roskam <fomcl at yahoo.com> 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

> 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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20091225/228b8e9e/attachment.htm>

More information about the Tutor mailing list