-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
PEP 712: Now convert all incoming values #3152
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
Conversation
|
My fork of CPython was also updated with the semantics changes. FYI @erictraut and @debonte, I'll make an issue in https://github.com/microsoft/pyright for the new semantics (primarily needing to type-check |
It looks like Pyright is already validating that |
|
I naively assumed that because the PEP didn't mention |
|
@CAM-Gerlach sorry to ping, but what's the protocol for merging an update PR? I assume I wait for an editor's suggestions? Also @ericvsmith I assume this about does it in terms of solidifying the behavior. When you get time, please read through and let me know what you suggest for next steps. Thanks to you both 😄 |
|
We'd generally want approval from the sponsor of the PEP before merging. |
|
@ericvsmith gentle bump 🙂 |
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.
I can't add review comments to lines that are already merged, so I'll add a few nits here.
Line 23 "A common feature these libraries provide ..." could use the word "other" before "libraries", since the previous sentence also refers to dataclasses.
Somewhere in the PEP you should say that these conversions are one-way: on setting attributes, not when reading them.
My main concern with the PEP has always been that there's no way to immediately see what the type of a field really is. You have to know the type returned by the converter. I'd like to see this point explicitly mentioned somewhere.
|
@ericvsmith, thanks for taking a look and providing feedback 🙌
I'm not sure exactly what you mean. The type of the field is still explicitly laid out when the dataclass is defined: @dataclass
class MyDataclass:
# a is of type `str` no matter what
a: str = field(converter=whatever) |
Oops, I meant the type of the thing you can pass in to the constructor. You have to know what |
I suspected, but didn't want to assume. And yeah that's fair. |
|
@ericvsmith please take another look. I don't foresee much additional changing so let me know what the appropriate next step is, from your experience 🙂 |
|
Friendly bump @ericvsmith 😄 I also realized that this takes effect for |
|
I think this version is good. |
|
Ready for merge 🚀 (And submission to SC) |
|
Thanks Josh, the next step would be to work with Eric to submit the PEP for approval. A |


PEP 123: Summary of changes)📚 Documentation preview 📚: https://pep-previews--3152.org.readthedocs.build/