4 ms·
I recently had to debug someone else's Python code and trying to figure out what variables are was a massive headache, especially coming from C++.
by secondcoming 1y ago
I recently had to debug someone else's Python code and trying to figure out what variables are was a massive headache, especially coming from C++.
- skydhash 1y agoI do not program that much in python, but I believe the general accepted wisdom in dynamic languages was explicit name and load of documentations (as comments and docstrings).
- imron 1y agoAbsolutely the general accepted wisdom in line with best practices - that are often ignored
- maleldil 1y ago> explicit name and load of documentations (as comments and docstrings). Which can be out of date are often missing. Might as well use type-hints that can be statically checked.
- skydhash 1y agoIf the name of a function and its docstring is out of date, then what you have is a bad culture for coding. It’s up there with god classes in OOP.
- Akronymus 1y agoEven c++ feels clunky in terms of types to me. Though that's probably down to me preferring a more complete type system like haskell has
- rcfox 1y agoIn Python, every variable is either defined or imported in the file in which it's used, so you always know where to find it. (Assuming you don't do `from foo import *`, which is frowned upon.) In C++, a variable might be defined in a header or in a parent class somewhere else, and there's no indication of where it came from.