SHARE
TWEET

http://pt.stackoverflow.com/questions/72685/existe-interface

a guest Jul 4th, 2015 217 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. >>> import abc
  2. >>> class Shape(object):
  3. ...     __metaclass__ = abc.ABCMeta
  4. ...     @abc.abstractmethod
  5. ...     def method_to_implement(self, input):
  6. ...         return
  7. ...
  8. >>> class Foo(Shape):
  9. ...     pass
  10. ...
  11. >>> foo = Foo()
  12. Traceback (most recent call last):
  13.   File "<stdin>", line 1, in <module>
  14. TypeError: Can't instantiate abstract class Foo with abstract methods method_to_implement
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top