metaclass error

F. Petitjean littlejohn.75 at news.free.fr
Thu Mar 17 21:42:46 CET 2005


Le 17 Mar 2005 12:27:07 -0800, asteele at berkeley.edu a écrit :
> dear readers,
> 
> i have a very simple package organized as follows:
> 
> !-----------------------------------------!
> bgp/
>     __init__.py
>     managers/
>             __init__.py
>             ManagerInterface.py
>             TestManager.py
> !-----------------------------------------!
> 
> and here's ManagerInterface.py and TestManager.py:
> 
> !-----------------------------------------!
> # ManagerInterface.py
> class ManagerInterface(object):
>     def __init__(self): pass
>     def process(self, recset, operation):
>         print 'In ManagerInterface.process()...'
> 
> # TestManager.py
> import ManagerInterface
#   ManagerInterface  is a module not a class !
#  try
from ManagerInterface import ManagerInterface
> class TestManager(ManagerInterface):
#  you can also define __init__ method with a super call
>     def process(self, recset, operation):
>         print 'In TestManager.process()...'
>         super(TestManager,self).process(recset,operation)
> !-------------------------------------------!
> 
> 
> thanks!
> aaron
> 



More information about the Python-list mailing list