3 ms·
Hmmm, it sounds like you're expecting "two" and "three" to be separate list elements because of some sort of implicit behavior due to being written in a list co
by dpedu 5y ago
Hmmm, it sounds like you're expecting "two" and "three" to be separate list elements because of some sort of implicit behavior due to being written in a list context. This is the opposite of what "Explicit is better than implicit" means.
This is a list and you must explicitly place a comma when you want to start a new element in the list. Is there ever a time a new element follows a previous one and is NOT separated by a comma? No, this is explicit.
Whereas, strings also always concatenate in this manner be it in a list context or not. It seems like you're assuming behaviors from other languages would be the same in another.
- doubleunplussed 5y agoYour sarcasm is misplaced. I would prefer a SyntaxError to either of the implicit behaviours.
- kazinator 5y ago> Is there ever a time a new element follows a previous one and is NOT separated by a comma? Yes: [ "one, two", "three" ] The comma is not an absolute context-free indicator of element separation.
- matsemann 5y agoNo, we don't want it to implicitly be a list item. We want it to fail as invalid syntax. If I wanted the two and three strings to be combined, I would have /explicitly/ used an operator for that. It's the implicit behavior of that which is the problem.
- fantod 5y agoNot to mention the implicit string concatenation that you get instead.
- ReleaseCandidat 5y ago> it sounds like you're expecting "two" and "three" to be separate list elements I'd expect that to be an error.
- lijogdfljk 5y agoFunny enough, in dynamic languages i expect it to do something unexpected and unwanted. This is why i like Go/Rust. I detest the implicit warts of these languages.
- ReleaseCandidat 5y agoWell, there are dynamic languages and dynamic languages. There are Python and Ruby and there are Elixir, Erlang and Lisps.
- wott 5y agoIt's not related to being dynamic or not, it's a syntactical choice: that's also the way to concatenate string literals in C.
- twobitshifter 5y agoI could see lisp programmers missing the commas out of muscle memory
- aylmao 5y agoAh yes, why would anyone expect lists' main purpose to be listing? Sarcasm aside, I'd assume people primarily list things in between [ and ], and sometimes concatenate things in there too. The language should err on the side of doing what people expect, unless explicitly told not to. > It seems like you're assuming behaviors from other languages would be the same in another. Rather, I think people expect a language, especially one this big and important, to work for them, and not to be designed with unergonomic features instead.
- bokchoi 5y agoI'm not a python programmer, but the implicit string concatenation seems surprising to me.
- Dudeman112 5y agoI'm not a python programmer either, but I would be seriously annoyed at implicit anything instead of syntax error
- kevin_thibedeau 5y agoIt's idiomatic in C.