相关疑难解决方法(0)

python中的通用方法

是否有可能在python中实现泛型方法处理程序,允许调用不存在的函数?像这样的东西:

class FooBar:
  def __generic__method__handler__(.., methodName, ..):
    print methodName

fb = FooBar()
fb.helloThere()

-- output --
helloThere
Run Code Online (Sandbox Code Playgroud)

python

8
推荐指数
2
解决办法
9617
查看次数

标签 统计

python ×1