Skip to content
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

RFC: Add filtering behavior to whos() #10108

Closed
wants to merge 1 commit into from

Conversation

jdlangs
Copy link
Contributor

@jdlangs jdlangs commented Feb 6, 2015

This change adds a filter keyword argument to the whos methods that takes one or more types that should not be displayed. It changes the default behavior to not display Module types.

I raised this issue in #9902 but didn't get any discussion going. I don't see any real use-case of needing to see what modules have been imported into Main, and as my example in the issue shows, it can be quite a large number. I think it makes sense to keep it less cluttered and to allow the current behavior through an additional argument. Plus it allows for other interesting options like excluding Functions and/or DataTypes.

@StefanKarpinski
Copy link
Member

Seems reasonable to me. @JeffBezanson?

@ViralBShah
Copy link
Member

I wish we can also show memory consumption...

@jdlangs
Copy link
Contributor Author

jdlangs commented Feb 11, 2015

Just changed the default filter objects so modules are only hidden when the plain whos() is called. So whos(SomeMod) will still show exported submodules.

Defaults to not displaying modules
@jdlangs
Copy link
Contributor Author

jdlangs commented May 6, 2015

I figure the 3 month anniversary is as good a time as any to bring this back up.

@StefanKarpinski, @ViralBShah, any other feedback? This appears to be a case of quite limited interest.

@StefanKarpinski
Copy link
Member

I think the functionality is useful but I'm not sure about the API. Since it's a function intended for interactive usage, however, it wouldn't be too awful to change it later if we come up with better.

@jdlangs
Copy link
Contributor Author

jdlangs commented May 6, 2015

I agree, it is somewhat awkward, but there's basically zero cost to changing it at any time. I'd be happy to implement other approaches.

I think there's some minor degree of importance, and not just personal preference, to having whos() not output imported modules. If I load code that brings in 20-30 (or 50...) modules, it would be a persistent annoyance to always see that list. That said, I am sure there are sometimes when you want to see the exported submodules (probably not in Main), so this was attempt to get the best of both worlds.

@StefanKarpinski
Copy link
Member

Aside from wishing for additional features, do you have any opinions about this, @ViralBShah?

@ararslan
Copy link
Member

I like this idea, but I agree that the API is a little funky. I actually asked a question on Stack Overflow looking for similar behavior. I'd also like to see an option for returning a symbol array rather than printing.

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.

4 participants