python properties and inheritance

后端 未结 10 1459
粉色の甜心
粉色の甜心 2020-12-12 18:06

I have a base class with a property which (the get method) I want to overwrite in the subclass. My first thought was something like:

class Foo(object):
    d         


        
10条回答
  •  攒了一身酷
    2020-12-12 18:42

    I agree with your solution, which seems an on-the-fly template method. This article deals with your problem and provides exactly your solution.

提交回复
热议问题