0

I am trying to create a python property to a variable inside a static class. I have made a simplified attempt doing so:

class c(object):
    _a = 5

    @staticmethod
    def a_get():
        print 'getter'
        return self._a

    @staticmethod
    def a_set(new_value):
        print 'setter'
        self._a = new_value

    a = property(a_get, a_set)

def main():
    print c.a

if __name__ == '__main__':
    main()

What I expect to happen - it will print getter 5

What actually happens - it prints the property itself (property object at <0x000000000308F1D8>).

What am I missing?

Yotam Hammer
  • 127
  • 1
  • 2
  • 8

0 Answers0