Skip to content

evolve() and attr.ib(init=False, default="foo") #251

Description

@hynek

As pointed out in ericvsmith/dataclasses#42 (comment) attr.evolve() behaves rather weird if an attribute has

  1. init=False,
  2. a default/__attrs_post_init__, and
  3. attribute(s) are modified on the instance.

The new resulting object will always have the default value.

I think I can live with that limitation if we document it and it's probably a good reason to resolve #207 with sticking assoc around with a better name?


Giving it further thought, the raison d'être for evolve are immutable objects…so I think it's fine to just document this edge case and leave it be?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions