properties and get/set methods
Timothy Grant
tjg at craigelachie.org
Sat Apr 5 17:29:15 EST 2003
Hi all,
Given the following class...
class monty(object):
def __init__(self):
self.__foo = 0
self.__bar = 0
def setvar(self):
do_some_attribute_generic_thing()
set_appropriate_attribute()
def getvar(self):
do_some_attribute_generic_thing()
return appropriate_attribute()
foo = property(getvar, setvar)
bar = property(getvar, setvar)
=====================================
Is it possible to determine which attribute was used to as the trigger for the
call to setvar() or getvar()? so that set_appropriate_attribute() or
appropriate_attribute() can set the correct attribute or get the correct
attribute?
Thanks.
--
Stand Fast,
tjg.
Timothy Grant
www.craigelachie.org
More information about the Python-list
mailing list