On 06/12/2017 00:16, Steve D'Aprano wrote:
Anyone got a handy copy of Python 3.6 available to test something for me?

What does compile('f"{spam} {eggs}"', '', 'single') return?

What does eval()'ing the above compiled object do? If necessary, you may have
to define spam and eggs first.


Thanks in advance.


rslt = compile('f"{spam} {eggs}"', '', 'single')

print( rslt )
print( "\n" )

spam = "SPAM"
eggs = "scrambled"
eRslt = eval( 'f"{spam} {eggs}"' )
print( eRslt )

Ran above test file and got,
>>python36 compiletest.py
<code object <module> at 0x0000000002120E40, file "", line 1>


SPAM scrambled
>>

Py version on Win 7 box
Python 3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)] on win32

Any help?
John
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to