top | item 34179708

(no title)

haaryball | 3 years ago

For me the greatest pain point with Python is that you are never sure about what any line of code does, because basically everything can be redefined.

It might not be a big issue in a small script, but as soon as you get a biggish codebase, with mixins or magical utilities written a couple of years ago by a developer who in the meantime left, it takes hours just to track the control flow in the mess of patched methods, dunder stuff calling nested supers, etc.

To say nothing of big frameworks like DRF. There isn't even an agreed-on way to mark methods that are overridden from a base class.

Plus, simply changing the order of imports can violently change the semantics of the exact same code.

A fetish for hidden magic, state everywhere, and basically global coupling of code vastly override the supposedly simple syntax: it might be easy to read, but it is impossible to understand, locally.

discuss

order

pjmlp|3 years ago

True of any dynamic language. The only way to avoid such gotchas is with static typed languages.

But only those without any means of indirect calls via function pointers or reflection.