Skip to content

Feature: support @field.default decorator for attrs #2012

@yangdanny97

Description

@yangdanny97

Describe the Bug

Attrs allows setting a default factory for a dataclass field x by decorating a function with @x.default. I don't think we support this today

https://www.attrs.org/en/stable/init.html#defaults

Looks similar to x.setter/x.deleter for properties, so I imagine the implementation for that might be a good reference

Sandbox Link

No response

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions