Design by Contract for Python

Terence Way terry at wayforward.net
Wed May 14 03:20:47 EDT 2003


I'm interested in adding pre-conditions, post-conditions, invariant 
assertions into Python code...  just like in Eiffel.

I'm putting together an implementation, more details here:
     http://www.wayforward.net/pydbc/

I'm wondering if there's any other implementations out there... I know 
of three:

1. Design By Contract for Python by R. Plosch
     Nice PDF, good paper, no implementation, uses __getattr__ hacking
2. PyDBC by Daniel Arbuckle
     An implementation based on __metaclass__.  Must be coded as 
separate functions.
3. Examples used by Guido van Rossum to describe attribute descriptors.

Are there any others?

Do any support the full features of Eiffel-style assertions: support of 
old values, support for inheritance, inclusion in documentation, no 
overhead when assertions are disabled?

Cheers!






More information about the Python-list mailing list