Design by Contract for Python

Aahz aahz at pythoncraft.com
Thu May 15 13:38:18 EDT 2003


In article <mailman.1053002903.4843.python-list at python.org>,
Terence Way  <terry at wayforward.net> wrote:
>
>Although I like the "grouping" that you propose.  But I'm not sure it
>would work with inheritance ("virtual" functions).  Or variable
>arguments.  I wish instance methods could have their own dict,
>just like static functions.  Then you could do:
>     class foo:
>          def func(self, a, b):
>                ...
>          func.pre = ...
>          func.post = ...

Huh?

class C(Exception):
    def f(self):
        pass
    f.x = 1

print C.f.x
print C().f.x
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"In many ways, it's a dull language, borrowing solid old concepts from
many other languages & styles:  boring syntax, unsurprising semantics,
few automatic coercions, etc etc.  But that's one of the things I like
about it."  --Tim Peters on Python, 16 Sep 93




More information about the Python-list mailing list