Abstract methods in python - is this a good way ?)

Robert Kern rkern at ucsd.edu
Sun Aug 7 07:24:05 EDT 2005


Philipp H. Mohr wrote:
> Hello,
> 
> I would like to use abstract methods in python to force some of the
> classes to implement common methods.
> 
> I found this web page and wonder if it is a good way of implementing them:
> 
> http://www.lychnis.net/blosxom/programming/python-abstract-methods-3.lychnis

It's okay. I prefer interfaces, though.

http://peak.telecommunity.com/PyProtocols.html
http://www.zope.org/Wikis/Interfaces/FrontPage

> Also could some one please tell me what the type class is which
> 
> class Metaclass (type):
> 
> is inheriting from.

It's the builtin type object. Metaclasses inherit from it.

http://www.python.org/2.2/descrintro.html

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter




More information about the Python-list mailing list