Properties for several keywords

K

Kless

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

-----------------------------
@property
def foo(self):
return self._foo

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

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

@property
def bar(self):
return self._bar

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

Kless

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

-----------------------------
@property
   def foo(self):
      return self._foo

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

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

@property
   def bar(self):
      return self._bar

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

Sorry for indent the decorator.
 
K

Kless

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

-----------------------------
@property
   def foo(self):
      return self._foo

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

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

@property
def bar(self):
   return self._bar

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

Please, is there any solution for this problem?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,289
Messages
2,571,450
Members
48,127
Latest member
svastipharmancrr

Latest Threads

Top