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

Improve handling of __dir__ and fixed list of GAP globals #15

Open
embray opened this issue Mar 29, 2021 · 0 comments
Open

Improve handling of __dir__ and fixed list of GAP globals #15

embray opened this issue Mar 29, 2021 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@embray
Copy link
Owner

embray commented Mar 29, 2021

This is basically the same as https://trac.sagemath.org/ticket/27923

Sage's libgap did this because it tried to restrict the tab-completion to only "documented" functions in GAP, but where "documented" is somewhat ill-defined, and generating the complete list of documented globals at runtime is very slow.

I have asked the GAP developers about this in the past and they have also recommended against it. Using a hard-coded list also means globals added by common packages are not picked up.

Generating a list of global variables (excluding GAP keywords) is simple and reasonably fast:

In [23]: keywords = set(gap.GAPInfo['Keywords'])

In [24]: gap_globals = [g for g in gap.Filtered(gap.NamesGVars(), gap.IsBoundGlobal) if g not in keywords]

In [25]: %timeit gap_globals = [g for g in gap.Filtered(gap.NamesGVars(), gap.IsBoundGlobal) if g not in keywords]
51.8 ms ± 1.61 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
@embray embray added the enhancement New feature or request label Mar 29, 2021
@embray embray added this to the v0.1.0 milestone Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant