This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author crwilcox
Recipients crwilcox, jitterman, zach.ware
Date 2020-02-11.01:29:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1581384590.38.0.888643047424.issue39601@roundup.psfhosted.org>
In-reply-to
Content
Double curly braces do not indicate to not process the inner content. They indicate to include a literal curly brace. That said, I think there may be something not quite correct.

I came up with an example based on the example in the format specifiers section of the PEP.

From the PEP.
```
>>> width = 10
>>> precision = 4
>>> value = decimal.Decimal('12.34567')
>>> f'result: {value:{width}.{precision}}'
'result:      12.35'
```
The template in this instance is "10.4"

If we leave the sample the same, but don't wrap width or precision in single curly braces,
```
>>> f'result: {value:width.precision}'
```
I would expect the template "width.precision".

Further, I would expect
```
>>> f'result: {value:{{width}}.{{precision}}}'
```
to have a template of "{width}.{precision}". This is not the case.


Here is some code that should demonstrate this.
```
class Decimal:
    def __init__(self, value):
        pass
    def __format__(self, template):
        return template
width = 10
precision = 4
value = Decimal('12.34567')
print("Expect Template to be '10.4' (TRUE)")
print(f'result0: {value:{width}.{precision}}')
print("Expect Template to be 'width.precision' (TRUE)")
print(f'result1: {value:width.precision}')
print("Expect Template to be '{width}.{precision}' (FALSE)")
print(f'result2: {value:{{width}}.{{precision}}}') # ACTUAL: {10}.{4}
```
History
Date User Action Args
2020-02-11 01:29:50crwilcoxsetrecipients: + crwilcox, zach.ware, jitterman
2020-02-11 01:29:50crwilcoxsetmessageid: <1581384590.38.0.888643047424.issue39601@roundup.psfhosted.org>
2020-02-11 01:29:50crwilcoxlinkissue39601 messages
2020-02-11 01:29:50crwilcoxcreate