[Python-ideas] Why is design-by-contracts not widely

Steven D'Aprano steve at pearwood.info
Fri Sep 28 19:39:08 EDT 2018

On Fri, Sep 28, 2018 at 07:18:54PM +0200, 2qdxy4rzwzuuilue at potatochowder.com wrote:
> On 9/28/18 12:45 PM, Steven D'Aprano wrote:
> >On Tue, Sep 25, 2018 at 09:59:53PM +1000, Hugh Fisher wrote:
> >
> >>C and Python (currently) are known as simple languages.
> >
> >o_O
> >
> >That's a usage of "simple" I haven't come across before. Especially in
> >the case of C, which is a minefield of *intentionally* underspecified
> >behaviour which makes it near to impossible for the developer to tell
> >what a piece of syntactically legal C code will actually do in practice.
> s/C/Python/
> s/underspecified/dynamic/
> ;-)

I see the wink, but I don't see the relevance. Are you agreeing with me 
or disagreeing?

Python is "simple" in the sense that the execution model is *relatively* 
simple, but its not a minimalist language by any definition. And as you 
say, the execution model is dynamic: we can't be sure what legal code 
will do until you know the runtime state.

(Although we can often guess, based on assumptions about sensible, 
non-weird objects that don't do weird things.)

But none of that compares to C undefined behaviour. People who think 
that they are equivalent, don't understand C undefined behaviour.




More information about the Python-ideas mailing list