[Python-3000] PEP 3124 - Overloading, Generic Functions, Interfaces, etc.

Phillip J. Eby pje at telecommunity.com
Wed May 9 18:34:02 CEST 2007


At 09:58 PM 5/8/2007 -0400, Chris Monson wrote:
>If we are looking at doing Design By Contract using @before and 
>@after (preconditions and postconditions), shouldn't there be some 
>way of getting at the return value in functions decorated with @after?

Actually, it isn't really design by contract; i.e., I wasn't using 
the word "postconditions" in the DBC sense.  I was saying you could 
put code there to *ensure* (i.e. implement) additional 
postconditions, not *check* them.

If you wanted to implement DBC, it might be simplest to subclass 
overloading.Around to create a Contract class and @contract 
decorator, with a higher method-combination precedence than Around 
methods.  Indeed, that might make another nice example for the PEP.



More information about the Python-3000 mailing list