Skip to content

Allow the usage of the grave accent character (`) for string literals and string formatting #125418

@harmin-parra

Description

@harmin-parra

Feature or enhancement

Proposal:

Currently, string literals in python are surrounded by apostrophes (') or quotation marks (")

a = "first string"
b = 'second string'

The inconvenience is that if we want a string containing both ' and ", we need to escape them

c = "string with \" and ' characters"
d = 'string with " and \' characters'
e = f"string {a} with \" and {b} with ' characters"

It would be nice to use the accent character as a third option to surround string literals and string substitutions, so I can do

f = `string with " and ' characters without escaping`
g = f`string {a} with " and {b} with ' characters without escaping`

It is the case with Javascript and node.js

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions