Static typing, Python, D, DbC

John Nagle nagle at animats.com
Sat Sep 11 18:53:38 EDT 2010


On 9/11/2010 9:36 AM, Lie Ryan wrote:
> On 09/12/10 00:33, Bearophile wrote:
>
>> ----------------
>>
>> Lately while I program with Python one of the D features that I most
>> miss is a built-in Design By Contract (see PEP 316), because it avoids
>> (or helps me to quickly find and fix) many bugs. In my opinion DbC is
>> also very good used with doctests.
>
>> You may implement a poor's man DbC in Python like this:
>
> I would do it like this:

    Design by contract really isn't a good fit to Python.  I've
done proof of correctness work, and there are suitable languages
for it.  It needs a language where global static analysis is
possible, so you can reliably tell what can changes what.

				John Nagle



More information about the Python-list mailing list