[Python-Dev] PEP 461 - Adding % and {} formatting to bytes

Eric V. Smith eric at trueblade.com
Wed Jan 15 23:14:06 CET 2014


On 1/15/2014 4:32 PM, Ethan Furman wrote:
> A question for anyone that has extensive experience in both %-formatting
> and .format-formatting:  Would it be possible, at least for int and
> float, to take whatever is in the specifier and convert to %?  Example:
> 
>   "Weight: {wgt:-07f}".format(wgt=137.23)
> 
> would take the "-07f" and basically do a "%-07f" % 137.23 to get the
> ASCII to use?

I think the int.__format__ version might be a superset. Specifically,
the "n" and "%" types. There may well be others.

But I think we could say we're not going to support these in b"".format().



More information about the Python-Dev mailing list