DEV Community

Discussion on: Why all this hate about Python?

Collapse
 
davips profile image
davips

Refactoring is a nightmare. Add an extra argument to a function and expect to get errors in the distant future when an infrequent condition is met during execution and some remote part of the code calling the function with the old argument list will break.

Collapse
 
aoeu256 profile image
Alexis Rodriguez • Edited

If you add the extra argument as an optional it will work nice much of the time.

def func1(a, b, extra = 5):
----func2(5, a+b, extra=extra)

Doctests are good documentation and easy to write (just copy and paste your console session), but its true its hard to exercise EVERY code path. You can also automatically create some doctests by doing using a createTest decorator i.e: f = createTest(f) for all f in user defined modules, but no guarantees.

As long as your not doing some complex polymorphism, pylinters can catch many although not all errors. I believe some of them use "Type Inference".

I wonder how do Smalltalk and Lisp solve this problem? Did they go the Erlang route and reload code on errors?