【发布时间】:2015-06-10 15:20:30
【问题描述】:
我正在尝试创建一个代表unipath.Path 对象的custom trait。重用File trait 提供的机制似乎是有利的,所以我的想法是使用多重继承。
from unipath import Path
from traits import File
class PathTrait(Path,File):
pass
class A(HasTraits):
p = PathTrait()
然而,当我通过A(p='/tmp/') 使用它时,A.p 没有任何与Path 对象关联的方法,正如我所料。我应该实现get 和set 方法吗?
【问题讨论】: