Author jitterman
Recipients crwilcox, eric.smith, jitterman, zach.ware
Date 2020-02-11.22:32:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1581460325.66.0.434690080891.issue39601@roundup.psfhosted.org>
In-reply-to
Content
Okay, I get it. Someone might be using two braces in the format specifier because they found that it is a way to both evaluate a sub-expression and get braces in the formatted result. I was thinking that they would just use three braces, but that does not appear to work, though I cannot understand the resulting error message.

    >>> x = 42
    >>> import datetime
    >>> now = datetime.datetime.now()

    >>> f'{now:x{x}x}'
    'x42x'

    >>> f'{now:x{{x}}x}'
    'x{42}x'

    >>> f'{now:x{{{x}}}x}'
    Traceback (most recent call last):
    ...
    TypeError: unhashable type: 'set'

I think you are right. This particular ship may have already sailed away.
History
Date User Action Args
2020-02-11 22:32:05jittermansetrecipients: + jitterman, eric.smith, zach.ware, crwilcox
2020-02-11 22:32:05jittermansetmessageid: <1581460325.66.0.434690080891.issue39601@roundup.psfhosted.org>
2020-02-11 22:32:05jittermanlinkissue39601 messages
2020-02-11 22:32:05jittermancreate