←back to thread

620 points tambourine_man | 1 comments | | HN request time: 0.216s | source
Show context
nu11ptr ◴[] No.43750542[source]
Personally, this feels like a feature that is too focused on one problem to be a general feature. Python is getting huge. When people ask me if Python is easy and simple to learn I have to say "the basics, yes, but to to learn the whole language... not so much".

I feel like in this sense Go really is interesting by rejecting almost every single feature. Honestly not sure generics were worth it as they add a lot of complexity, and while they are nice, I don't need them very much. The general idea to keep the language at its original focus is the right idea IMO. C++ would be the most extreme case where the language itself barely resembles what it started out as.

replies(4): >>43750633 #>>43750807 #>>43751386 #>>43754916 #
oliwarner ◴[] No.43750807[source]
Python has always been a batteries-included language, so having a go at templated string interpolation —a feature other languages have had for decades— seems like a strange gripe.

It's far more essential than little utilities like textwrap or goliath packages like Python's bundled tkinter implementation.

replies(2): >>43751281 #>>43754791 #
nu11ptr ◴[] No.43751281[source]
What other languages have this feature? I'm not aware of any
replies(5): >>43751420 #>>43751592 #>>43751869 #>>43752805 #>>43753962 #
thatnerdyguy ◴[] No.43751869[source]
C# has InterpolatedStringHandler which isn't quite the same thing, but (in my understanding), trying to address the same core issues.
replies(2): >>43753144 #>>43753879 #
1. WorldMaker ◴[] No.43753144[source]
C# InterpolatedString is very close, with the twisty bit being that C# can rely on static typing for safety so the "f-string" and "t-string" variants use the same literal syntax and depend on what function they are passed to, whereas in both Python and Javascript they have different literal syntaxes. Python chose to use a different literal prefix to its literals ("f" versus "t") and Javascript chose to use a function-call syntax as prefix (`templateString` versus html`templateString` where html is a function in scope).