Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

interface in python

import zope.interface
  
  
class MyInterface(zope.interface.Interface):
    x = zope.interface.Attribute("foo")
    def method1(self, x):
        pass
    def method2(self):
        pass
      
print(type(MyInterface))
print(MyInterface.__module__)
print(MyInterface.__name__)
  
# get attribute
x = MyInterface['x']
print(x)
print(type(x))
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #interface #python
ADD COMMENT
Topic
Name
2+2 =