PowerSeries element class appears in the TAB completion

78 views
Skip to first unread message

davida...@gmail.com

unread,
Mar 29, 2022, 9:12:57 AM3/29/22
to sage-devel
Hello everybody,

During my normal uses of SageMath, I observed that the class "PowerSeries" appears in the TAB completion:

    sage: PowerSeries[TAB]
                                     PowerSeries
                                     PowerSeriesRing

However this is the base class for the elements of a PowerSeriesRing and the docstring explicitly states that it is not for public use:

    sage: PowerSeries?
    Docstring:
       A power series. Base class of univariate and multivariate power
       series. The following methods are available with both types of
       objects.
    Init docstring:
       Initialize a power series. Not for public use. It gets called by
       the "PowerSeries_poly" and "MPowerSeries" constructors.
    [...]

I am not as experimented as some of you in SageMath development so before creating a trac ticket about this I wanted to know if this is intentional? From my understanding, when implementing a new parent/element framework, one should not instanciate directly the element class but use the parent's element constructor instead (or other related method).

It is the same story with the classes "PuiseuxSeries" and "LaurentSeries" which are the element classes of "PuiseuxSeriesRing" and "LaurentSeriesRing" respectively. Are there times where someone would want to use these directly?

Thanks!

Travis Scrimshaw

unread,
Mar 29, 2022, 10:59:51 PM3/29/22
to sage-devel
I don't think such classes were meant to get into the public namespace as they are not so useful (such as promoting a polynomial to a power series). Indeed, as you say, these classes should not be created directly (as they do not have a redirect to pass data to a parent; cf. SemistandardTableau).

Please open a trac ticket for this (you can cc me on it with "tscrim" in the cc field). If you can also push a fix (the top-level imports will also need to be deprecated), that would be appreciated too.

Best,
Travis

Matthias Koeppe

unread,
Mar 29, 2022, 11:36:03 PM3/29/22
to sage-devel

davida...@gmail.com

unread,
Mar 30, 2022, 11:23:15 AM3/30/22
to sage-devel
Thank you both for your suggestions, here's the ticket:  https://trac.sagemath.org/ticket/33602

Also, do we want the name "lazy_import" in the global namespace? In the developer's manual it says that it should not, see https://doc.sagemath.org/html/en/developer/coding_in_python.html#deprecation, but maybe these instructions are little bit outdated. 

Matthias Koeppe

unread,
Mar 30, 2022, 12:02:24 PM3/30/22
to sage-devel
lazy_import is most likely imported into sage.all by accident.
Reply all
Reply to author
Forward
0 new messages