I had this idea while reading #4522. This probably shouldn't block hex_codes_in_unicode_sequences from being stabilized since it is an edge case, but would be nice to have.
playground link Currently, f"{'\xFF'}" does not get formatted. It should be formattable to f"{'\xff'}".
Note that any changes here have to be careful of f-string debug statements. This formatting would not have any effect since \xXX is resolved in the string literal before the formatting output happens
>>> f"{'\xFF'=}"
"'ÿ'='ÿ'"
>>> f"{'\xff'=}"
"'ÿ'='ÿ'"
but if there is ever a situation where the formatting is applied when the escape isn't resolved, then the behavior would change observably.
I had this idea while reading #4522. This probably shouldn't block
hex_codes_in_unicode_sequencesfrom being stabilized since it is an edge case, but would be nice to have.playground link Currently,
f"{'\xFF'}"does not get formatted. It should be formattable tof"{'\xff'}".Note that any changes here have to be careful of f-string debug statements. This formatting would not have any effect since
\xXXis resolved in the string literal before the formatting output happensbut if there is ever a situation where the formatting is applied when the escape isn't resolved, then the behavior would change observably.