Properties for several keywords

Kless jonas.esp at
Sun Jun 7 07:45:26 EDT 2009

I've to write properties for several keywords with the same code, it
only changes the name of each property:

   def foo(self):
      return self._foo

   def foo(self, txt):
      self._foo = self._any_function(txt)

# ----------------

   def bar(self):
      return self._bar

   def bar(self, txt):
      self._bar = self._any_function(txt)

Is possible to simplify it?

More information about the Python-list mailing list