[Python-ideas] Simplicity of C (was why is design-by-contracts not widely)
steve at pearwood.info
Sat Sep 29 21:54:13 EDT 2018
On Sat, Sep 29, 2018 at 09:50:27AM +1000, Hugh Fisher wrote:
> Oh FFS. You couldn't make the effort to read the very next sentence,
> let alone the next paragraph, before responding?
Hugh, your mind-reading powers are fading. I read not just the next
sentence and paragraph but the entire post. They aren't relevant to my
comment: I still disagreed with your description of C (in particular)
as "simple" although I'm willing to accept that Python is *relatively*
simple in some ways.
Just because I disagree with you doesn't mean I didn't read your post.
The next sentence was:
When starting a programming project in C or Python, there's maybe a
brief discussion about C99 or C11, or Python 3.5 or 3.6, but that's
it. There's one way to do it.
followed by criticism of C++ for being "designed with a shovel rather
than a chisel", and the comment:
C++ programming projects often start by specifying exactly which
bits of the language the programming team will be allowed to use.
And in-house style guides for Python often do the same. For example,
Google's style-guide for Python bans the use of "Power features" such as
custom metaclasses, access to bytecode, on-the-fly compilation,
dynamic inheritance, object reparenting, import hacks, reflection,
modification of system internals, etc.
Other choices include whether to use a functional style or object-
oriented style or both.
Design By Contract is a methodology. People already decide whether to
use TDD or design up front (or don't decide on any methodology at all
and wing it). They can already decide on using Design By Contract, if
they like the existing solutions for it.
This discussion is for those of us who would like to include DbC in our
projects but don't like existing solutions. C++ being designed with a
shovel is not relevant.
(Except in the sense that we should always be careful about piling on
feature upon feature into Python.)
More information about the Python-ideas