f-string

Chris Angelico rosuav at gmail.com
Sat Dec 9 01:15:38 EST 2017


On Tue, Dec 5, 2017 at 6:37 PM, Ned Batchelder <ned at nedbatchelder.com> wrote:
> On 12/5/17 7:16 PM, Steve D'Aprano wrote:
>> compile('f"{spam} {eggs}"', '', 'single')
>
>     $ python3.6
>     Python 3.6.3 (default, Octâ  4 2017, 06:03:25)
>     [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin
>     Type "help", "copyright", "credits" or "license" for more information.
>      >>> compile('f"{spam} {eggs}"', '', 'single')
>     <code object <module> at 0x105e79660, file "", line 1>
>      >>> co = _
>      >>> spam = 17
>      >>> eggs = 34
>      >>> eval(co)
>     '17 34'
>      >>> dis.dis(co)
>      â  1â â â â â â â â â â  0 LOAD_NAMEâ â â â â â â â â â â â â â â  0
> (spam)
>      â â â â â â â â â â â â â  2 FORMAT_VALUEâ â â â â â â â â â â â  0
>      â â â â â â â â â â â â â  4 LOAD_CONSTâ â â â â â â â â â â â â â  0 ('
> ')
>      â â â â â â â â â â â â â  6 LOAD_NAMEâ â â â â â â â â â â â â â â  1
> (eggs)
>      â â â â â â â â â â â â â  8 FORMAT_VALUEâ â â â â â â â â â â â  0
>      â â â â â â â â â â â â  10 BUILD_STRINGâ â â â â â â â â â â â  3
>      â â â â â â â â â â â â  12 PRINT_EXPR
>      â â â â â â â â â â â â  14 LOAD_CONSTâ â â â â â â â â â â â â â  1
> (None)
>      â â â â â â â â â â â â  16 RETURN_VALUE
>

We have another batch of duplicated messages coming through. Are they
related to the previous issue? Possibly noteworthy: they all seem to
have a consistent issue with character encoding.

ChrisA


More information about the Python-list mailing list