Re: Call a classmethod on a variable class name

2008-04-13 Thread Gary Herron
Matthew Keene wrote: > I would like to be able to call a specific classmethod on a class name > that is going to be passed from another parameter. In other words, I > have a call that looks something like: > >x = Foo.bar() > > and I would like to generalise this so that I can make this call on

Re: Call a classmethod on a variable class name

2008-04-13 Thread Matthew Keene
Arnaud Delobelle wrote: > > If your class lives in the current global namespace, you can get it > with > > >>> cls = globals()[classname] > > Then you can access its .bar() method directly: > > >>> cls.bar() > > Example: > > >>> class Foo(object): > ... @classmethod > ... def

Re: Call a classmethod on a variable class name

2008-04-13 Thread Arnaud Delobelle
On Apr 13, 9:51 am, Matthew Keene <[EMAIL PROTECTED]> wrote: > I would like to be able to call a specific classmethod on a class name > that is going to be passed from another parameter.  In other words, I > have a call that looks something like: > >    x = Foo.bar() > > and I would like to general

Call a classmethod on a variable class name

2008-04-13 Thread Matthew Keene
I would like to be able to call a specific classmethod on a class name that is going to be passed from another parameter. In other words, I have a call that looks something like: x = Foo.bar() and I would like to generalise this so that I can make this call on any particular class which provi