Can I create class properties during __new__ or __init__?

前端 未结 4 1045
忘了有多久
忘了有多久 2021-01-18 23:52

I want to do something like this, but I haven\'t had much success so far. I would like to make each attr a property that computes _lazy_eval only when accessed:

<         


        
4条回答
  •  广开言路
    2021-01-19 00:17

    You can access class attributes through the __ class __ dict

    self.__class__.attr
    

提交回复
热议问题