Missing interfaces in Python...

Egon Frerich e.frerich at nord-com.net
Mon Apr 17 17:39:39 EDT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Have a look at Zope 3.
(http://www.zope.org/DevHome/Wikis/DevSite/Projects/ComponentArchitecture/FrontPage).
It has an interface implementation. You can use this implementation with
the apllication server Zope 3 or alone.

Regards,
Egon

redefined.horizons at gmail.com schrieb am 17.04.2006 22:39:

> I'm coming from a Java background, so please don't stone me...
> 
> I see that Python is missing "interfaces". The concept of an interface
> is a key to good programming design in Java, but I've read that they
> aren't really necessary in Python. I am wondering what technique I can
> use in Python to get the same benefits to a program design that I would
> get with interfaces in Java.
> 
> For example, if I want to have a program with a Car object, and a Bus
> object. I want both of these objects to present a common group of
> methods that can be used by Mechanic objects, but slightly different
> methods that can be used by Driver objects.
> 
> In Java I would accomplish this by defining an IFixable interface that
> would be implemented by both the Car and Bus objects. Mechanic objects
> would work with any object implementing this interface.
> 
> How would I approach this problem in Python? I think I would use an
> abstract class instead of an interface for IFixable, since Python
> supports multiple inheritance, but I'm not sure this is correct.
> 
> Thanks for any suggestions.
> 
> Scott Huey
> 

- --
Egon Frerich, Freudenbergstr. 16, 28213 Bremen

E-Mail: e.frerich at nord-com.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (MingW32)
Comment: GnuPT 2.7.2
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFERAsZuTzybIiyjvURAn4wAJ4qCaqAZu4BmnZzrltVAneyWwmh+wCeI8DV
DwNlvYJed/22Ls8Jct4fKV4=
=8eTo
-----END PGP SIGNATURE-----



More information about the Python-list mailing list