Skip to content

Support _replace (etc.) with namedtuple #661

Closed

Description

@JukkaL

Reported by Dedoig:

Mypy disallows usage of _replace() method from namedtuple (and likewise for NamedTuple).

from collections import namedtuple
Person = namedtuple("Person", 'name')
p = Person("bob")
p._replace(name="sam")

==> "Person" has no attribute "_replace"

Also, these are missing:

  • _asdict()
  • _fields

Activity

  1. added this to the milestone on Aug 18, 2016
  2. ddfisher commented on Aug 18, 2016

    @ddfisher
    Collaborator

    Should be fixed by #1810.

  3. elazarg commented on Sep 3, 2016

    @elazarg
    Contributor

    Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions