JitterMan <pythonb...@shalmirane.com> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39601>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to