I usually do that this way:
class IExpense:
def id(self):
raise NotImplementedError
class TimeExposure(IExpense):
def __init__(self, ...):
...
def id(self):
...
HTH
Franz GEIGER
"Uwe Mayer" <> schrieb im Newsbeitrag
news:c2c8kk$oat$...
> Hi,
>
> in my program I want to "specify" that some object implements i.e. the
> dictionary or list interface.
> What is the Python way to do that?
>
> i.e. in Java I'd include an interface.
> in Python I could write an abstract class and inherit from it (probably
> needs multiple inheritance), or I could just specify that in a comment.
>
> What'd you suggest?
> Thanks in advance
> Uwe
>
|