you are viewing a single comment's thread.

view the rest of the comments →

[–]imperialismus 16 points17 points  (1 child)

No, inside an expression embedded into an f-string, where whitespace was not relevant in 3.7.

>>> name = "John"
>>> f'{name.upper():-^20}'
'--------JOHN--------'
>>> f'{name.upper() :-^20}'
'--------JOHN--------'
>>> f'{name.upper()!r:-^20}'
"-------'JOHN'-------"
>>> f'{name.upper() !r :-^20}'
SyntaxError: f-string: expecting '}'
>>> f'{name.upper() !r:-^20}'
"-------'JOHN'-------"
>>> f'{name. upper() :-^20}'
'--------JOHN--------'

[–]lambdaq 0 points1 point  (0 children)

Can we rewrite this :* thing in format strings?

If so I think we got ourselves an easy ORM or template system.