Why can't I assign a class method to a variable?

Lie Ryan lie.1296 at gmail.com
Sun Oct 26 07:40:49 EDT 2008


On Wed, 22 Oct 2008 12:34:26 -0400, ed wrote:

> I'm trying to make a shortcut by doing this:
> 
> t = Globals.ThisClass.ThisMethod
> 
> Calling t results in an unbound method error.
> 
> Is it possible to do what I want?  I call this method in hundreds of
> locations and I'm trying to cut down on the visual clutter.
> 
> Thank you!

Remember that in python when you do:

A_instance = A()
A_instance.foo(a, b)

is actually the same as

A_instance = A()
A.foo(A_instance, a, b)




More information about the Python-list mailing list