FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

`_make`, `_asdict` and `_replace` methods on `NamedTuple` should be decorated with `@final` · Issue #15894 · python/typeshed · GitHub

_make, _asdict and _replace methods on NamedTuple should be decorated with @final #15894

Description

they can't be overridden at runtime:

from typing import NamedTuple, override


class Bar(NamedTuple):
    @override
    def _asdict(self) -> dict[str, object]: ...
AttributeError: Cannot overwrite NamedTuple attribute _asdict

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL