Restricted generic type hint in Python

前端 未结 0 967
栀梦
栀梦 2020-11-22 03:27

I want to create a factory method like here.

class A:
    ...

class B(A):
    def f(self):
        ...

class C:
    ...

def factory(cls):
    return cls()
         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题