-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Don't show built-in modules in whos() #19999
Conversation
@@ -667,7 +667,7 @@ Print information about exported global variables in a module, optionally restri | |||
|
|||
The memory consumption estimate is an approximate lower bound on the size of the internal structure of the object. | |||
""" | |||
function whos(io::IO=STDOUT, m::Module=current_module(), pattern::Regex=r"") | |||
function whos(io::IO=STDOUT, m::Module=current_module(), pattern::Regex=r"^(?!.*(Base|Main|Core)).*$") |
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.
this would also filter names like StatsBase
. Maybe it should just skip calling summarysize
on value in (Base, Main, Core)
?
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.
Alright, I gave that a go.
Good now, @vtjnash ? |
bytes = summarysize(value) | ||
if bytes < 10_000 | ||
@printf(head, "%6d bytes ", bytes) | ||
if s ∈ ("Base", "Main", "Core") |
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 would do exactly value ∈ (Base, Main, Core)
, so that it filters those exact items, and not something with the same name
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.
Done
@printf(head, "%6d KB ", bytes ÷ (1024)) | ||
bytes = summarysize(value) | ||
if bytes < 10_000 | ||
@printf(head, "%6d bytes ", bytes) |
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.
maybe should use prettyprint_getunits
, if we're going to print contractions?
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.
Can we save that for another PR, since it's not really related to my change?
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.
ah, right yes. Github mislead me with the indentation change highlighting to think you were adding it
Windows failure seems unrelated |
It's very time-consuming (almost 10 seconds on my machine) to compute the
summarysize
ofBase
,Core
, andMain
, makingwhos()
an impractical tool for quickly seeing my custom workspace variables. It also seems like unnecessary information, since those modules are always available at the REPL and almost never need to be explicitly accessed.Thus, I propose not showing those by default. They're still available with
whos(r".*")
.