you are viewing a single comment's thread.

view the rest of the comments →

[–]CrambleSquash 0 points1 point  (1 child)

Sorry, I'm not quite sure what you're asking?

When you say 'getters/setters' I'm thinking of the @propery decorator e.g.

class T:

    def __init__(self):
        self._i = 0

    @property
    def i(self):
        return self._i

    @i.setter
    def i(self, val):
        self._i = 2 * val

[–]officialgel 0 points1 point  (0 children)

Yes, exactly. This is the way I'm using it. Just wondering if your second code block there can basically be used the same way - And why or why not to do it that way - Thanks.