[Python-3000] iostack and Oh Oh

Aaron Bingham bingham at cenix-bioscience.com
Fri Dec 8 11:15:00 CET 2006


Tim Hochberg wrote:
> Talin wrote:
>   
>> Phillip J. Eby wrote:
>>     
>>> At 09:59 AM 12/5/2006 -0600, Guido van Rossum wrote:
>>>       
>>>> My point is that an interface can *document* (at least in English) a
>>>> "contract" about the invariants between operations. While I'm not into
>>>> enforcing or verifying such contracts, I'm very interested in
>>>> documenting them. For example, something that has "mapping" behavior
>>>> has a very different relationship between x[y] and "y in x" than
>>>> something that has "sequence" behavior.
>>>>         
>>> I assumed this didn't need answering.  If you're using the interface solely 
>>> for documentation, then a namespace-oriented interface suffices to provide it.
>>>       
>> I'm guessing that Guido's use of the word 'document' means something 
>> more than just conveying information to a human reader.
>>
>>  From what I can tell, the argument boils down to this: You are saying 
>> that a class is merely the sum of its attributes and methods, and Guido 
>> is saying that it's not.
>>     
>
> That's not my interpretation. Let me throw out my spin on my 
> understanding of Philip's position.
>
> Here goes: to the extent that the semantics aren't clear from the 
> methods it is sufficient, and preferable, to attach the semantic 
> information to the methods rather their associated class.
>   
Of course we can attach the pre- and post-conditions of a method to the 
method itself, but there is semantic information that logically belongs 
with the class, namely, the class invariant.  If you can't attach the 
invariant to the class itself, you will be forced to repeat the 
invariant as a postcondition for every method. 

Regards,

-- 
--------------------------------------------------------------------
Aaron Bingham
Senior Software Engineer
Cenix BioScience GmbH
--------------------------------------------------------------------



More information about the Python-3000 mailing list