ANN: Design By Contract for Python 1.0 beta 3

Terence Way terry at wayforward.net
Sun Jun 22 19:19:21 CEST 2003


Announcing Design By Contract for Python 1.0 beta 3
(Changes since last announcement at end of this email)

Design by Contract is familiar to anyone who has spent time with the
Eiffel programming language.  This implementation is a cross between
full Eiffel-style contracts and the doctest module.

Contracts are high-level assertions that are part of the program's
documentation.  Modules and classes have invariants, expressions that
must be true at the start and end of every public function or method
call.  Methods and functions have pre-conditions, expressions that must
be true on entry; and post-conditions, expressions that must be true
on exit.

     http://www.wayforward.net/pycontract/

This version supports the full contract feature set:
   * pre: expressions in function and method docstrings;
   * post: expressions in function and method docstrings;
   * inv: expressions in class and module docstrings;
   * post: expressions can access __old__ values and the __return__
     value;
   * pre: expressions are weakened by derived methods; and
   * post: and inv: expressions are tightened by derived classes.

Version 1.0 beta 3 - 21 June 2003
   * Support Jython (possibly Python 2.1)
   * Support Python 2.2 (doesn't have bool, True, False: those are
     added in Python 2.2.1)
   * Partial contract checking - by default in __debug__ mode checks
     all contracts, otherwise only check pre-conditions and invariants
     on entry
   * Can now pass in module names to checkmod()...  This makes it easy
     to enable contracts: just do a contract.checkmod(__name__) at the
     end of a module.

<P><A HREF="http://www.wayforward.net/pycontract/">Contract 1.0 
beta3</A> -
Design By Contract for Python.  (21-Jun-03)






More information about the Python-list mailing list