class TestLine:
def init(self,x):
self.x = x
@property
Dear community,
I’m trying to work with so-called python properties, as in the example below.
def x(self): return self.__x
@x.setter def x(self, x): if x < 0: self.__x = 0 elif x > 1000: self.__x = 1000 else: self.__x = x
if name==“main”:
t = TestLine( 3 )
print "x = " + str(t.x)
t.x = -12 print "x = " + str(t.x)
t.x = 1207 print "x = " + str(t.x) print "Finished..."
The result should be due to the defined getter and setter property that
x = 3
x = 0
x = 1000
Finished…
However, the result shown is
x = 3
x = -12
x = 1207
Finished…
So it seems as the setter and getter properties are bypassed and the private __x is not used but just a public x is used instead.
The example is from a Python 3 tutorial… Which python version is supported by Rhino? Or is the problem still somewhere else?
Many thanks in advance.
Kind regards,
Filip