Skip to content

Add function ispackage to stdlib inspect #125633

@Xiaokang2022

Description

@Xiaokang2022

Feature or enhancement

Proposal:

Currently, the built-in module inspect lacks a function to determine whether an object is a package or not. This is a small but useful feature.

According to the documentation, this feature should not be difficult to implement, and we should add it to the standard library:

  1. Definition of a package
  2. module.__package__
  3. module.__name__
  4. module.__spec__

I've tried to implement this feature and will make a PR later.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dirtype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions