I don't think we should hide all aliases from tab-completion.  Apart from 
that, what my snippet does is essentially your second preference, except 
that removing an alias from `__dir__` is not sufficient to hide it from 
tab-completion.

Best wishes,

Martin

On Tuesday, 7 October 2025 at 19:22:44 UTC+2 Vincent Macri wrote:

> Aliases can be detected programmatically, that's how I removed them from 
> the HTML docs (or more specifically, listed them as an alias with a link to 
> the original instead of duplicating the docstring like we previously did) 
> recently in https://github.com/sagemath/sage/pull/40753
>
> There is a related issue to mark aliases in the interactive documentation: 
> https://github.com/sagemath/sage/issues/40759
>
> I like your suggestion not to pollute tab complete with aliases! But I 
> don't think marking aliases should be a manual process or involve 
> decorators, as that requires everyone to know about this and to 
> consistently use it. It would also mean either a patch bomb to add the 
> decorator to ever alias we alteady have, or many small patches adding them 
> throughout the codebase. Both of those options are annoying.
>
> My preference would be if whatever library/software handles tab 
> autocomplete has a way to exclude things through its public API, which is 
> however I removed aliases from the generated Sphinx docs. My second 
> preference would be to programmatically detect them in __dir__ (perhaps in 
> the SageObject __dir__ method?). I'm assuming this would have no impact on 
> runtime performance of Sage, and __dir__ only gets called when the user 
> tried to use tab autocomplete (if I'm wrong about how __dir__ works, then 
> please correct me). We should definitely profile this change either way 
> though if we are messing with magic methods of the base class of all Sage 
> classes. I don't think tab complete performance itself is really a concern 
> though. As long as it feels fast for users, adding even a couple 
> milliseconds to tab autocomplete isn't an issue.
>
> Vincent Macri (he/him)
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/sage-devel/499c5e86-eed5-4322-a5f7-9a8290b806bdn%40googlegroups.com.

Reply via email to