The Artima Developer Community
Sponsored Link

News & Ideas Forum (Closed for new topic posts)
Contracts in Python

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Bill Venners

Posts: 2284
Nickname: bv
Registered: Jan, 2002

Contracts in Python Posted: Feb 2, 2003 2:58 AM
Reply to this message Reply
Advertisement
Artima.com has published Part IV of an interview with Python creator Guido van Rossum, in which he talks about about the nature of contracts in a runtime typed programming language such as Python.

http://www.artima.com/intv/pycontract.html

Here's an excerpt:

In general in Python, there is a contract, but the contract is implicit. The contract isn't specified by an interface. There's nothing in what the parser sees at least that says x has to be an object that supports readline that you can call with no arguments and it returns a string that means a certain thing. But that contract is certainly in the documentation or specification.

In Java, if you say this is something that has a readline method that returns a string, what does it mean? Do you expect it to always return the same string? Does it ever return an empty string? There are all sorts of things that aren't expressed by that interface that you still have to specify in documentation. That's where the interesting competition between the different languages exists.


What do you think of Guido's comments?

Topic: Getting Started with Artima SuiteRunner Previous Topic   Next Topic Topic: Unit Testing with Mock Objects


Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2017 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us