Overwrite only one function with property()

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kai Kuehne

    #1

    Overwrite only one function with property()

    Hi list!
    It is possible to overwrite only one function with the property-function?

    x = property(getx, setx, delx, 'doc')

    I just want to overwrite setx, but when I set the others to None,
    I can't read and del the member. Any ideas or is this not possible?

    Thank you!
    Kai
  • George Sakkis

    #2
    Re: Overwrite only one function with property()

    Kai Kuehne wrote:
    Hi list!
    It is possible to overwrite only one function with the property-function?
    >
    x = property(getx, setx, delx, 'doc')
    >
    I just want to overwrite setx, but when I set the others to None,
    I can't read and del the member. Any ideas or is this not possible?
    There are no default functions for getx, setx, delx; you have to
    specify what you expect to happen when you write a.p, a.p = v and del
    a.p, respectively. What would, for example, be the default getx that
    you don't want to overwrite ?

    George

    Comment

    • gagsl-py@yahoo.com.ar

      #3
      Re: Overwrite only one function with property()

      On 18 nov, 19:06, "Kai Kuehne" <kai.kue...@gma il.comwrote:
      It is possible to overwrite only one function with the property-function?
      >
      x = property(getx, setx, delx, 'doc')
      >
      I just want to overwrite setx, but when I set the others to None,
      I can't read and del the member. Any ideas or is this not possible?
      Do you want to override the setter of an existing property, in a
      derived class?

      Comment

      • Bruno Desthuilliers

        #4
        Re: Overwrite only one function with property()

        Kai Kuehne a écrit :
        Hi list!
        It is possible to overwrite only one function with the property-function?
        property is not function, it's a class. And it doesn't "overwrite" anything.
        x = property(getx, setx, delx, 'doc')
        >
        I just want to overwrite setx, but when I set the others to None,
        I can't read and del the member.
        You don't "overwrite" setx, you pass it as an argument to the property
        constructor call.
        Any ideas or is this not possible?
        Read this, and you'll have a detailed answer:


        Thank you!
        Kai

        Comment

        Working...