See the following.
-- Paul

class X(object):
....pass

def makeAddr(tAdd):
....def add(self, tNum):
........return tNum + tAdd
....return add

# add methods to class X
X.add1 = makeAddr(1)
X.add100 = makeAddr(100)

# create an X object
x = X()

# invoke new methods
print x.add1( 50 )
print x.add100( 50 )

Prints:
51
150

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to