This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eric.smith
Recipients dkreeft, eric.smith, ezio.melotti, mrabarnett, paul.moore, steve.dower, tim.golden, zach.ware
Date 2020-09-29.15:19:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1601392779.71.0.579896138723.issue41885@roundup.psfhosted.org>
In-reply-to
Content
f-strings are indeed evaluated when the value of the string is needed. Your example is equivalent to:

>>> re.sub(r'([a-z]+)', fr"\112345", 'something')
'J345'

As always with regexes, you need to be careful when dynamically composing them.
History
Date User Action Args
2020-09-29 15:19:39eric.smithsetrecipients: + eric.smith, paul.moore, tim.golden, ezio.melotti, mrabarnett, zach.ware, steve.dower, dkreeft
2020-09-29 15:19:39eric.smithsetmessageid: <1601392779.71.0.579896138723.issue41885@roundup.psfhosted.org>
2020-09-29 15:19:39eric.smithlinkissue41885 messages
2020-09-29 15:19:39eric.smithcreate