Go is compiled, Python - interpreted.
Go focuses on concurrency, Python on making it easy to do things with code.
Many things that are a one-liner in Python (but itself or with a library), in Go take quite a lot of lines or boilerplate. For example, there is no built-in string templates in Go.
> Not sure if "Python 4.0" is the best comparison.
Or is it Python that is not best compared to "Python 4.0"? Python doesn't live up to the guiding principles of Python, such as preferring only one obvious way to do something. Go is, in many ways, more Python than Python.
> Many things that are a one-liner in Python
Case in point. Many of those one-liners are just as obviously expressed as multi-liners (e.g. list comprehension vs. traditional 'for' loop).
> no built-in string templates in Go.
Another good example. There is no special syntax, but the standard library provides. Special syntax would give two obvious ways to do it.
Hardly, given that it isn't as expressive as Python, that role belongs to Mojo.
The only reason so many folks leave Python for Go, is the usual problem of writing C libraries instead of finally having a proper JIT in CPython, and having PyPy being largely ignored by the community.
Go's structural typing allows for quite a lot of flexibility often otherwise only found in scripting languages (I would suspect that this was the single biggest reason as to why the TypeScript folks started to move to Go for the ported compiler rather than something like dotnet based like C#).
stared|6 months ago
Go is compiled, Python - interpreted. Go focuses on concurrency, Python on making it easy to do things with code.
Many things that are a one-liner in Python (but itself or with a library), in Go take quite a lot of lines or boilerplate. For example, there is no built-in string templates in Go.
9rx|6 months ago
Or is it Python that is not best compared to "Python 4.0"? Python doesn't live up to the guiding principles of Python, such as preferring only one obvious way to do something. Go is, in many ways, more Python than Python.
> Many things that are a one-liner in Python
Case in point. Many of those one-liners are just as obviously expressed as multi-liners (e.g. list comprehension vs. traditional 'for' loop).
> no built-in string templates in Go.
Another good example. There is no special syntax, but the standard library provides. Special syntax would give two obvious ways to do it.
pjmlp|6 months ago
The only reason so many folks leave Python for Go, is the usual problem of writing C libraries instead of finally having a proper JIT in CPython, and having PyPy being largely ignored by the community.
whizzter|6 months ago
justin66|6 months ago
Such a strange thing to write. Mojo doesn't even have classes yet.