Skip to content

When debug specifier _and_ format_spec are present, use !s as the conversion default #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Conversation

davepeck
Copy link

@davepeck davepeck commented Apr 10, 2025

Currently, t"{1=:foo}".interpolations[0] is Interpolation(1, '1', None, 'foo').

The section of PEP750 on the debug specifier says it should be Interpolation(1, '1', 's', 'foo').

Assuming we think the spec is right, here's a fix. (Otherwise, LMK and I'll fix the PEP.)

@davepeck davepeck requested a review from lysnikolaou as a code owner April 10, 2025 16:50
@lysnikolaou
Copy link
Owner

I think that's a spec issue. Having !s as the default would be a departure from what f-strings do, which is that they provide no default when there's a format_spec so that __format__ is called.

I'm wondering now how we can change the spec with the PEP having been accepted.

@davepeck
Copy link
Author

davepeck commented Apr 11, 2025

I'm wondering now how we can change the spec with the PEP having been accepted.

I’ll open a PR and find out. 😅

Annoyed at myself for not catching this earlier — I've been trying to go over spec vs implementation in detail and this is the first thing I’ve run across with the spec. Luckily it’s pretty minor.

@AA-Turner
Copy link

I'm wondering now how we can change the spec with the PEP having been accepted.

The intent is that "Accepted" is different from "Final" to allow for changes made during the implementation of the feature

@lysnikolaou
Copy link
Owner

The intent is that "Accepted" is different from "Final" to allow for changes made during the implementation of the feature

Oh got it. Thanks for the clarification!

@davepeck
Copy link
Author

Closing without merge in favor of the PR on PEP750

@davepeck davepeck closed this Apr 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants