2 ms·
For all the (little) work I have done with JS I used the same technique of string concatenation, and I don't really see an issue with writing "+ instead of { (r
by asgard1024 11y ago
For all the (little) work I have done with JS I used the same technique of string concatenation, and I don't really see an issue with writing "+ instead of { (respectively +" instead of }).
Ruby has a different philosophy than Python, was originally intended to be Perl replacement, and is more open to cryptic shortcuts like this.
While in Python, the presumably better format() syntax was a step to actually longer code, character-wise, than old C-style % interpolation. Python simply tries to be more explicit, because it is used in more domains than just text processing; similar arguments can be raised against Python's treatment of regular expressions.
- sanderjd 11y agoAh, well, I guess all I can really say then is that it seems like you're knocking it before you've tried it. It's not any more or less cryptic or explicit than the alternatives, it's just a different, and quite convenient, way of expressing the same thing.