4 ms·
Those type of errors will be caught by the compiler. It's definitely a problem for python-like languages (but not for compiled languages) because there's no com
by fractalb 5y ago
Those type of errors will be caught by the compiler. It's definitely a problem for python-like languages (but not for compiled languages) because there's no compilation step involved before running the code.
- NavinF 5y agoIt’s a compiled language in the same sense that Java is compiled. Most people use the CPython implementation which compiles .py files to .pyc files before executing them. That compiler can’t catch bugs of this form because it’s not always a bug. That’s just how dynamic languages work. But if Python had a different syntax like “let var = value” for creating new variables rather than mutating existing ones, we wouldn’t have this specific problem. That’s what this thread is about. If C++ inferred “auto” for all assignments/initializations, it would have a similar problem where typos in assignments effectively lead to that line of code getting skipped.