Here is our modified class inspired by the recipe : Method : Class PYTHON TUTORIALS


PYTHON TUTORIALS » Class » Method »

 

Here is our modified class inspired by the recipe


class HideX(object):
    def __init__(self, x):
        self.x = x

    @property
    def x():
        def fget(self):
            return ~self.__x

        def fset(self, x):
            assert isinstance(x, int)'"x" must be an integer!'
            self.__x = ~x

        return locals()



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Class
» Method