Skip to content

Add more useful help for special name in help() #137574

@Locked-chess-official

Description

@Locked-chess-official

Feature or enhancement

Proposal:

Now, use help("__name__") and some other special variables' names will still get the help from their class. I think that we can add the useful help on them. For example:

>>>help("__name__")
1. module.__name__ : if the module is run as the main module, the value is_main_‘, or the name is the filename of the module. For example:if __name__ == "__main__": ...can control which code dont run when the module is imported.

2. cls.__name__: the name of the class. It must be str.

For other special variables (such as __file__), we can alse print the similar detailed help. And I think that the sentences need to be friendly.

Also welcome to give the ideals on new ideas

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions