-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
Enhance namespace package repr #98139
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
Comments
This is tricky, the proposal removes the loader from the repr, which is useful information, and makes it possible to have ridiculously big reprs due to including the search paths, but it does produce arguably better reprs for lots of situations. I am slightly inclined towards keeping the current repr. @jaraco thoughts? |
I like this feature suggestion, I can think of a couple times it would have helped some people at work. I'm not sure how intentional showing the loader in the repr was (e.g. 3.9 shows just |
IMO, the paths where the namespace is loaded are particularly useful. I'm +1 to the proposal. I'm not sure that I've ever used the repr of the loader except to recognize that it's a namespace package, which is retained in the proposal. Filipe mentions the risk of ridiculously big reprs, which seems like a plausible scenario, even with just a couple of very long paths. Still, being able to see the paths in the repr seems a lot more valuable than the memory address of the loader. I'm thinking that almost all uses of this repr are going to be for internal troubleshooting anyway, so I'm not terribly concerned about the size of the repr. I'm not aware of any situations where large reprs could cause problems, though I certainly don't have a full survey of user experiences. |
Implemented in #98870. |
Uh oh!
There was an error while loading. Please reload this page.
Feature or enhancement
After
Loader.module_repr
has been deprecated, the repr of namespace is like:<module 'xx' (<_frozen_bootstrap_external.NamespaceLoader object at 0x0000000>)>
which is unreadable. So I purpose the following repr:
<module 'xx' (namespace) from ['path1', 'path2']>
The change purposed to code is:
In my interpreter test:
If OK, I can open PR, and add test code.
Previous discussion
The text was updated successfully, but these errors were encountered: