junxnone / xwiki

https://junxnone.github.io/xwiki/
0 stars 0 forks source link

Programing Python Decorator property #306

Open junxnone opened 3 months ago

junxnone commented 3 months ago

@property decorator

class ds(object):
  @property
  def temp(self):
    return 11
  def temp_wo_p(self):
    return 12

d1 = ds()
print(d1.temp)
print(d1.temp_wo_p())
print(d1.temp_wo_p)
11
12
<bound method ds.tw of <__main__.ds object at 0x7fd3d03c8550>>