3 ms·
Technically, Python does have strong typing: it's just dynamic, not statically typed. I can see how static typing helps avoid errors on a larger project. It's
by ForHackernews 6y ago
Technically, Python does have strong typing: it's just dynamic, not statically typed. I can see how static typing helps avoid errors on a larger project.
It's hard for me to understand how using indentation for scoping would be a "big problem" on a large/long-lived project. Whitespace vs brackets seems purely an aesthetic choice to me. Don't most people indent their bracketed languages anyway?
- animatedb 6y agoThere is the mypy static type checker that works very well with Python. It works with the typing module that allows unions of types, and other methods. Using the --disallow-untyped-defs command line argument provides more checking. A function prototype could look like the following where the str and int are the types. def strlen(check_str:str) -> int:
- RcouF1uZ4gsC 6y ago>It's hard for me to understand how using indentation for scoping would be a "big problem" on a large/long-lived project. Editors screw up whitespace all the time. Many times when moving a block of code using cut and paste, it is easy to screw up the indenting. With brackets/braces, it is a simple thing to just reformat. With python, you have to make sure that you did not screw up the semantics (is this statement part of the if or not). A long-lived project likely undergoes a decent amount of refactoring and code reorganization. Having to worry about messing up the semantics of your code every time you move a block of code is not that great.
- ForHackernews 6y agoSounds like a tooling problem, not a language problem. If editors screw up whitespace "all the time" it's only because whitespace is non-significant in many programming languages. Maybe we need better Python-focused editors that will automatically strip out irrelevant curly braces.