Introduce 'expr' keyword

Ideally, this would be an IDE feature.

The issue is that IDE by default can only know the obvious places to do this, such as __all__.

Thus, the need for standard way to hint IDE.

Mechanics:

  1. It wouldn’t evaluate the expression.
  2. It would do a parsing for valid syntax

So minimal correctness check by parser.
But yes, would not do the same amount of validation as if expression was evaluated.

Possible solutions:

name = <keyword> expr
name = f'{=expr}'        # This was my proposal some time ago
name = nameof(var)       # This is C# solution (which is only for variable name)
name = e'expr'           # another string type...
name = f'{expr!e}'

I like last one most:

  1. Doesn’t introduce new keyword
  2. Works with arbitrary expression (as opposed to nameof)
  3. Does not introduce new string type (too many of those already, reserving whole string type for a feature like this is too much IMO)
  4. Localises it nicely to be part of f-strings as opposed to something completely new (I don’t think it deserves its own thing - string type, keyword, …)
  5. Can be used as part of f-strings in combination to all of the other nice features of it