To implement converting printf-style string formatting into f-string expressions (see issue28307) I need to add new convertors:
'd': int(x) where x is a number, used for %d, %u, %i
'i': operator.index(i), used for %x, %o, %b
'f': float(x) where x is a number, used for %f, %g, %e
They may be private, only exposed in the AST between optimizer and code generator. But they can also be supported by Python grammar and str.format() if there is a use case for this.
If 'd' be used for other purposes, I will need to find other character for converting a number to integer (with possible truncation). Any suggestions? |