GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-132661: Add default value (of `""`) for `Interpolation.expression` by davepeck · Pull Request #136441 · python/cpython

Conversation

@davepeck

@davepeck davepeck commented Jul 8, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Per pending updates to PEP 750, we now provide an empty string default for Interpolation.expression.

If you're using t-string literals, Interpolation.expression is set to the original source text. But if you're writing code that creates Interpolation instances directly, there isn't always an obvious choice for expression.

  • Issue: Implement PEP 750 – Template Strings #132661

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
davepeck added 2 commits July 8, 2025 23:51
@davepeck
Add default for Interpolation.expression of ""
e623f20
@davepeck
Blurb the Interpolation.expression default.
80ae523
@bedevere-app bedevere-app Bot mentioned this pull request Jul 8, 2025
Implement PEP 750 – Template Strings #132661
Closed
@davepeck
Merge branch 'main' into pep750-expression-default
cd5627a
@davepeck
davepeck marked this pull request as ready for review July 9, 2025 00:24
@davepeck
davepeck requested a review from lysnikolaou as a code owner July 9, 2025 00:24
@bedevere-app bedevere-app Bot added the awaiting review label Jul 9, 2025
@davepeck
Merge branch 'main' into pep750-expression-default
d733d11
lysnikolaou
lysnikolaou reviewed Jul 9, 2025
View reviewed changes

@lysnikolaou lysnikolaou left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a test that checks that instantiating an Interpolation without an expression actually populates expression with the empty string and it's good to go!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

davepeck reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
davepeck added 3 commits July 9, 2025 10:13
@davepeck
Merge branch 'main' into pep750-expression-default
88423e5
@davepeck
Add support for Interpolation default values.
c8976f4
@davepeck
Merge branch 'main' into pep750-expression-default
9cc1cc4
@davepeck

davepeck commented Jul 9, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Let's add a test that checks that instantiating an Interpolation without an expression actually populates expression with the empty string and it's good to go!

Sure; done!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

davepeck added 2 commits July 9, 2025 22:01
@davepeck
I think I prefer this more explicit implementation of assertInterpola…
879a0d7
…tionEqual()
@davepeck
Merge branch 'main' into pep750-expression-default
17a6ef2
lysnikolaou
lysnikolaou approved these changes Jul 10, 2025
View reviewed changes

@lysnikolaou lysnikolaou left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @davepeck!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Jul 10, 2025
@lysnikolaou lysnikolaou added the needs backport to 3.14 bugs and security fixes label Jul 10, 2025
@lysnikolaou
lysnikolaou merged commit f1b8d01 into python:main Jul 10, 2025
@bedevere-app bedevere-app Bot removed the awaiting merge label Jul 10, 2025
@miss-islington-app

miss-islington-app Bot commented Jul 10, 2025

Copy link
Copy Markdown

Thanks @davepeck for the PR, and @lysnikolaou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 10, 2025
@davepeck @miss-islington
pythongh-132661: Add default value (of "") for `Interpolation.expre…
5e82765
…ssion` (pythonGH-136441)

(cherry picked from commit f1b8d01)

Co-authored-by: Dave Peck <[email protected]>
@bedevere-app

bedevere-app Bot commented Jul 10, 2025

Copy link
Copy Markdown

GH-136511 is a backport of this pull request to the 3.14 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Jul 10, 2025
lysnikolaou pushed a commit that referenced this pull request Jul 10, 2025
@miss-islington @davepeck
[3.14] gh-132661: Add default value (of "") for `Interpolation.expr…
95baa28
…ession` (GH-136441) (#136511)

Co-authored-by: Dave Peck <[email protected]>
AndPuQing pushed a commit to AndPuQing/cpython that referenced this pull request Jul 11, 2025
@davepeck @AndPuQing
pythongh-132661: Add default value (of "") for `Interpolation.expre…
0f2138d
…ssion` (python#136441)
@brianschubert brianschubert mentioned this pull request Jul 12, 2025
Add default value for expression parameter of string.templatelib.Interpolation python/typeshed#14403
Merged
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
@davepeck @Pranjal095
pythongh-132661: Add default value (of "") for `Interpolation.expre…
12feef5
…ssion` (python#136441)
picnixz pushed a commit to picnixz/cpython that referenced this pull request Jul 13, 2025
@davepeck @picnixz
pythongh-132661: Add default value (of "") for `Interpolation.expre…
0bbfd63
…ssion` (python#136441)
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
@davepeck @taegyunkim
pythongh-132661: Add default value (of "") for `Interpolation.expre…
994b63d
…ssion` (python#136441)
Agent-Hellboy pushed a commit to Agent-Hellboy/cpython that referenced this pull request Aug 19, 2025
@davepeck @Agent-Hellboy
pythongh-132661: Add default value (of "") for `Interpolation.expre…
64e9fd5
…ssion` (python#136441)
kumaraditya303 pushed a commit to miss-islington/cpython that referenced this pull request Sep 9, 2025
@miss-islington @davepeck @kumaraditya303
[3.14] pythongh-132661: Add default value (of "") for `Interpolatio…
dfb02c2
…n.expression` (pythonGH-136441) (python#136511)

Co-authored-by: Dave Peck <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@lysnikolaou lysnikolaou lysnikolaou approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@davepeck @lysnikolaou
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.