I want to use ZopeInterfaces, however my project is based on Python 3.x - any suggestions?

117 views Asked by At

Zope Interfaces are a great way to get some Java-style "design by contract" into a python program. It provides some great features such as implement-able interfaces and a really neat pattern for writing adaptors for objects.

Unfortunately, since it's part of a very mature platform which runs just fine on Python 2.x the developers of Zope.Interface have not yet prioritised porting to Python 3. I'd probably do the same in their situation. :-)

What I want to know is:

Is there another way to achieve a similar effect on the 3.x platform? I want to use the same kinds of patterns that Zope.Interface makes easy but I don't want to roll my own interfaces system. Or I should just forget about interfaces for now and design around this problem.

2

There are 2 answers

3
Ned Deily On

There appears to be a Python 3 branch of Zope Interfaces here and announced here.

1
nosklo On

Use python 2.x. It is more supported by most libraries. It has many 3.x features plus all 3rd party libraries. Later when dependencies are available you can migrate to py3 using 2to3.