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
bpo-34963: Make the repr of the typing.NewType() result more meaningful. #9951
bpo-34963: Make the repr of the typing.NewType() result more meaningful. #9951
Conversation
Add attributes __qualname__ and __module__. If the name argument is dotted, the __name__ attribute will be set to its last component.
I actually like this solution. But before merging let us wait for the benchmarks for other approach, if they are OK, maybe we can have an even nicer repr in #9808
When you're done making the requested changes, leave the comment: |
LGTM, but I would prefer that one of the typing maintainer double check this change. @ilevkivskyi?
I worked also on alternate implementations. But I don't know what properties should the NewType result have. |
Any news about PR? |
@serhiy-storchaka: This PR still LGTM. You can merge it.
It doesn't seem to define module. It doesn't seem to be directly related. This PR looks simple enough. |
It looks like the author of other PR is not responding. I leave up to Serhiy whether to just move with this PR or incorporate some ideas from other one too as I proposed in https://bugs.python.org/issue34963#msg328707 (This PR LGTM as is.) |
@serhiy-storchaka shall we move ahead with this or the alternate PR? |
This PR still applies and it would be useful, is there anything blocking it from being merged? |
Closing and reopening since it looks like some tests are hanging. |
@serhiy-storchaka Can you look at the test failure? Maybe it just needs a merge from a more recent main branch? |
It needs some correction in |
Go for it!
|
typing.NewType has been reimplemented as a class in bpo-44353, so this trick is no longer needed. |
Add attributes
__qualname__
and__module__
.If the name argument is dotted, the
__name__
attribute will be set to its last component.https://bugs.python.org/issue34963
The text was updated successfully, but these errors were encountered: