← Back to context

Comment by Stratoscope

4 days ago

You seem to be making things more difficult for yourself than they need to be.

For the strings, just use f-strings and forget all the others. You can even do things like this for debugging:

  >>> class User:
  ...     pass
  ... user = User()
  ... user.name = "Surac"
  ...
  >>> print(f"{user.name=}")
  user.name='Surac'
  >>>

For the block indenting, what editor are you using? Pretty much every modern editor lets you select a block and indent/unindent with Tab/Shift+Tab.

VS Code and PyCharm are both free and are great for Python coding. They each have a full debugger, which is invaluable when you are learning a language.

I think their point is that it's not clear to someone with 0% Python experience which of the /many/ different ways of doing things (like string interpolation) is the "correct" / idiomatic way.