Skip to content

Do not import lazy_import into the top-level namespace #36721

@jhpalmieri

Description

@jhpalmieri

Problem Description

lazy_import is imported in sage.misc.all, but I don't see a reason for this: most users won't ever use this, especially in an interactive Sage session. The ones who want to use it can figure out where to import it from.

Proposed Solution

So let's not import lazy_import. This should wait until #36676 is merged, since that touches many all.py files. lazy_import is imported in many of those, and #36676 does del lazy_import in most of them, but the import in sage.misc.all is preserved, since it is conceivable it could have been intentional. Let's remove that final instance.

Alternatives Considered

Leave things as they are? In general I like the idea of removing semi-arcane items from the global namespace, and lazy_import qualifies.

Additional Information

Somewhat related: #25383.

Is there an existing issue for this?

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions