Created
June 4, 2019 18:27
-
-
Save brydavis/b3a8ef4a31b78b1286acc6169f88d3f1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A: | |
def __init__(self, x): | |
self._x = x | |
@property | |
def y(self): | |
return self.x * 2 | |
@y.setter | |
def y(self, val): | |
self.x = val / 2 | |
a = A(10) | |
a.y = 30 | |
a.y * 20 | |
class B: | |
def __init__(self, x): | |
self._x = x | |
self._y = x * 2 | |
def x(self, val=None): | |
if val: | |
self._x = val | |
self._y = val * 2 | |
return self._x | |
def y(self, val=None): | |
if val: | |
self._y = val | |
self._x = val / 2 | |
return self._y | |
b = B(10) | |
b.y(30) | |
b.y() * 20 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment