[Python-ideas] Why is design-by-contracts not widely
rosuav at gmail.com
Sat Sep 29 15:46:39 EDT 2018
On Sun, Sep 30, 2018 at 12:43 AM Steven D'Aprano <steve at pearwood.info> wrote:
> On Sat, Sep 29, 2018 at 10:15:42PM +1000, Chris Angelico wrote:
> > As are all the things that are "undefined behaviour" in C, like the
> > result of integer overflow in a signed variable. They are "Here be
> > dragons" territory, but somehow that's not okay for you. I don't
> > understand why you can hate on C for having behaviours where you're
> > told "don't do that, we can't promise anything", but it's perfectly
> > acceptable for Python to have the exact same thing.
> They're not the same thing, not even close to the same thing.
> Undefined behaviour in C is a radically different concept to the
> *implementation-defined behaviour* you describe in Python and most
> (all?) other languages. I don't know how to communicate that message any
> better than the pages I linked to before.
Considering that many people here, myself included, still haven't
understood what you're so het up about, I think you may need to work
on communicating that better. It's still just "stuff you should never
do". The compiler is allowed to assume you will never do it. How is
that even slightly different from "the CPython interpreter is allowed
to assume you won't use ctypes to change a reference count"?
More information about the Python-ideas