dynamically inserting function into an object
hanz
hanzspam at yahoo.com.au
Thu Jan 13 12:04:35 EST 2005
# class Cell(object):
# def __init__(self, initialvalue = 0):
# self._func = lambda x: x
# self.__value = initialvalue
#
# def setvalue (self, newvalue):
# self.__value = self._func(newvalue)
#
# def getvalue (self):
# return self.__value
#
# def delvalue (self):
# del self.__value
#
# value = property(getvalue, setvalue, delvalue, "I'm the 'value'
property.")
#
# def curry(self, func, *args):
# self._func = lambda x: func(x, *args)
More information about the Python-list
mailing list