[Tutor] how-to do black magic
Adam Groszer
adamg@mailbox.hu
Fri May 16 04:11:03 2003
Dear All,
How-to do the following.
I have a list of properties let's say in a text file.
>From this list I'd like to create a class's properties and getter/setter
methods with a metaclass.
Is this possible? How?
example:
text file:
Name
Value
class:
class sample(base):
def setName(self, val):
self.__Name=val
def getName(self):
return self.__Name
Name = property(getName, setName, None, 'this is my Name')
def setValue(self, val):
self.__Value=val
def getValue(self):
return self.__Value
Value = property(getValue, setValue, None, 'this is my Value')
something like this, or likely behavior
Adam