I have some python code which looks similar to this:
class Car(BaseClass) :
manufacturer = factory.string()
model = factory.string()
modelYear = factory.integer()
def __str__(self):
return '%s %s %s' % (self.modelYear, self.manufacturer,
self.model)
def factory.string(self)
s = String() # creates a string object
#... # does several things
return s # returns the string object
-
I would like to simplify it in this way:
class Car(BaseClass):
manufacturer = factory.string(2) # 2 = position number...
model = factory.string(3) # ...withinn __str__
modelYear = factory.integer(1)
def factory.string(self, position)
s = String() # creates a string object
... # does several things
# creates somehow the __str__ functionality...
return s # returns the string object
-
How could I achieve this?
..
--
http://lazaridis.com