Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Make dataclasses construct automatic docstrings lazily #144764

Copy link
Copy link
@adamchainz

Description

@adamchainz
Issue body actions

Feature or enhancement

Proposal:

Profiling import time on a client project revealed ~30% of the time for dataclasses was spent creating the docstring, mostly because inspect.signature() is costly. In most executions, this time is wasted, as such automated docstrings are rarely referred to during normal execution.

It’s possible to make the docstring generation lazy by writing a descriptor class.

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

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-dataclassestype-featureA feature request or enhancementA feature request or enhancement
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.