Hacker News new | past | comments | ask | show | jobs | submit login

Why is looking similar to the PHP method inherently a bad thing?

About 15 years ago when I was starting my life as a professional programmer PHP's way of handling strings was seen as inferior to stuff like:

> name = 'Jane'

> print 'Hello, %s' % (name)

but I can't exactly reproduce all the discussions from back then. As for me personally I can see that I dislike the new

> print(f'Hello {name}')

format because my editor cannot instantly show me that {name} is in a fact a variable, and now that I wrote this down I remember that this was one of the complaints made against PHP's use of "Hello, $name" . But maybe newer editors do in fact recognize {name} as a Python variable, in any case it looks and feels "impure", for a lack of a better word.

VScode and PyCharm recognise variables in f-strings correctly. I'm not sure how "%s" is more pure than "{name}". They are both variables, only in the case of "%s" you add a level of indirection.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact