module exports a property instead of a class -- Evil?
Lonnie Princehouse
finite.automaton at gmail.com
Fri Apr 29 15:18:57 EDT 2005
The property factory is nice, but have you considered subclassing
property?
class Mode(property):
def __init__(self, *vals):
if [v for v in vals if not isinstance(v,str)]:
raise ValueError, 'Mode values must be strings'
else:
self.values = list(vals)
property.__init__(self, self.get, self.set)
def get(self, instance):
...
def set(self, instance, value):
...
More information about the Python-list
mailing list