4 ms·
Don't the first 3 apply just as well to python? It compiles fast, and is duck-typed so interfaces are always there and implicit, and the indent-based blocking
by Pxtl 13y ago
Don't the first 3 apply just as well to python? It compiles fast, and is duck-typed so interfaces are always there and implicit, and the indent-based blocking ends many arguments about formatting.
- dekhn 13y agothe difference is that if you're not careful when you cut-paste indented blocks in python, you can easily change logic.
- mau 13y agoIf you cut and paste probably the misaligned indentation is the least problem. Cut and paste should be avoided if it's not done during a refactoring (so actual moving of code for better design). Beginners usually think Python strong indentation is a weakness of the language. I actually find C++ freedom being more error prone: if (a < b); a = b It's a not very frequent bug, but when it happens it takes you hours to spot. ;)
- maxiepoo 13y agoYes and in Go (and hopefully all curly-brace languages of the future) this is actually a syntax error, you need the braces: if (a < b) { a = b; }
- gnur 13y agoAnd you don't need the semicolons!
- TylerE 13y agoThe thing I don't get...if braces are mandatory (Good), why keep the now completely, unambiguously, irrelevant () around the cond?
- deleted 13y ago[deleted]
- CasualSuperman 13y agoThey're actually not required in Go.
- wtbob 13y agoYou don't need those parens in Go, and go fmt will in fact remove them/
- kyrra 13y agoIf you ran the code through gofmt, it would remove the () around the cond for you. I code go in SublimeText with GoSublime. On every save it runs the file through gofmt and reformats it for me. Keeps my code looking pretty with very little effort.
- dekhn 13y agoThis would never happen to me because I frequently format my doc, and it wouldn't be indented.
- Artemis2 13y agoPython executes, it does not compiles. EDIT: Whoops, it's actually compiled into bytecode then executed by the VM.
- the_paul 13y agoThis is not true.
- runjake 13y agoAs the_paul said, this is incorrect. https://en.wikipedia.org/wiki/Python_(programming_language)#Implementations https://en.wikipedia.org/wiki/Python_(programming_language)#...
- mimighost 13y agoIt actually "compiles" into bytecode, then consumed by the interpreter.
- Pxtl 13y agoit's generous to call the CPython interpreter a VM - the binary encoding of Python isn't some crazy IL bytecode, its' really just python-as-binary. Language constructs converted into opcodes, strings with pre-calculated hashes, and local variables within a scope become a sort of vector... but otherwise, it's a prettymuch 1:1 mapping between Python language constructs and the bytecode form.