You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Interfaces can declare non-method attributes that should be provided by implementations using property...
In the meanwhile it seems that the module does not make any difference between setter, getter, and deleter of a property.
classIWalk(interface.Interface):
defwalk(self):
pass@propertydefshoes(self):
pass@shoes.setterdefshoes(self, value):
pass@shoes.deleterdefshoes(self):
passclassHuman(interface.implements(IWalk)):
def__init__(self, shoes):
self._shoes=shoesdefwalk(self):
shoes=self.shoesprint('I am walking {}'.format(f'with my {shoes}'ifshoeselse'barefoot'))
@propertydefshoes(self):
returnself._shoes
The above code runs perfectly fine, though Human does not provide any implementations for setter and deleter of the shoes property.
The problem gets more significant when a client of the IWalk interface tries to set (or delete) the shoes property:
According to docs,
In the meanwhile it seems that the module does not make any difference between setter, getter, and deleter of a property.
The above code runs perfectly fine, though
Human
does not provide any implementations for setter and deleter of theshoes
property.The problem gets more significant when a client of the
IWalk
interface tries to set (or delete) theshoes
property:The text was updated successfully, but these errors were encountered: