4 ms·
Funny that years and years ago, when I started learning python (2.5, in 2006), design by contract in Python was considered a shameful practice of people coming
by mk89 10y ago
Funny that years and years ago, when I started learning python (2.5, in 2006), design by contract in Python was considered a shameful practice of people coming form different backgrounds and languages. TDD and "unit tests" were already the keys to heaven at that time, considered the new way of developing high-quality programs with less bugs.
I find it way clearer than having different tests due to the overhead brought in by the dynamic nature of the language. I don't find it necessarily wrong or not Pythonic. Afterall, in a static typed language you also don't have contracts on parameters/return values (all you have is the type).
However, this will be seen, as it was years and years ago, as a bad practice. Great agile developers write tests over tests to determine what a function should return and what should not accept.