Help! Classes and function arguments

Adam Clark bjrubble at shell16.ba.best.com
Mon Aug 21 22:13:52 EDT 2000


Hi, I'm having this issue with functions and classes.  Basically I want to
bind functions to classes in multiple ways, and it's not working.

I want to have a library Types.py with functions and classes like:

def OneFunction (foo, bar) :
	pass

def TwoFunction (foo, bar) :
	pass

class OneClass () :
	func = OneFunction

class TwoClass () :
	func = TwoFunction

At this point, calling a function through a class will result in 'self' being
prepended to the arguments.  I can handle that, although I don't want it.

But, later on in some other place I want to say

t = Types.OneClass
t.func = Types.TwoFunction

Now if I call the function 'self' isn't prepended, and all my positional
arguments are out of whack.

Is there any way to make this work?

Thanks
Adam



More information about the Python-list mailing list