Comment by meowface
11 years ago
As a professional Python developer and amateur Go dabbler, I very vehemently disagree.
Without access to list/dict/set comprehensions, or libraries like itertools, or a lightweight lambda syntax or something like Ruby's blocks, transformations on collections will always be considerably more tedious and verbose.
Various functions have "bring-your-own-buffer" calling conventions, which will often double or triple the number of lines required for those function calls.
No tuple unpacking, no ability for functional programming (Python's isn't that amazing but with functools and some of the builtins, you can get pretty far), no operators for string formatting or anything but absolute barebones operations.
Combine that with what Go lacks even compared to languages like Java (no inheritance [which is usually an anti-pattern but does decrease verbosity when used properly], no generics, no deep type/class reflection) and it's hard to say that Go isn't a verbose language.
No statically typed language is going to be as terse or expressive as Python can be.
Can you explain how tuples are significantly different from multiple returns in real programs? You can do
When dealing with function calls, they're roughly the same.
But how about things like:
Or in Python 3+:
You can do that in go with just a few more characters:
I'll grant you, having to specify the indices is slightly more verbose, but it's also a lot more clear... because what happens when g has more or less than 3 elements? In Go it's clear, more is ok, less will get you a panic.
Again, I don't think the magic unpacking is really helping that much... doing it the same way you'd do anything else in Go is slightly more verbose, but it's also not some new syntax you have to figure out either.