classification
Title: The string prefixes u and f can't used together
Type: crash Stage: resolved
Components: Unicode Versions: Python 3.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Aifu LIU, benjamin.peterson, ezio.melotti, serhiy.storchaka, vstinner
Priority: normal Keywords:

Created on 2018-05-17 06:25 by Aifu LIU, last changed 2018-05-17 07:10 by serhiy.storchaka. This issue is now closed.

Messages (3)
msg316883 - (view) Author: Aifu LIU (Aifu LIU) Date: 2018-05-17 06:25
The string prefixes u and f can't used together, for example:

>>> age = 30
>>> s = uf'年龄:{age}'
  File "<stdin>", line 1
    s = uf'年龄:{age}'
                   ^
SyntaxError: invalid syntax
>>>
msg316884 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2018-05-17 06:38
Why would you want to do that?
msg316890 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-05-17 07:10
The string prefix u is used exclusively for compatibility with Python 2. It helps writing code that works in Python 2 and Python 3. The string prefix f is not compatible with Python 2. If you use it, you no longer have reasons for using the string prefix u.
History
Date User Action Args
2018-05-17 07:10:00serhiy.storchakasetstatus: open -> closed

nosy: + serhiy.storchaka
messages: + msg316890

resolution: not a bug
stage: resolved
2018-05-17 06:38:52benjamin.petersonsetnosy: + benjamin.peterson
messages: + msg316884
2018-05-17 06:25:08Aifu LIUcreate