Skip to content

Separate makers for hash, dict, eq, and repr #82

Description

@pfw

I've found myself using make_init with arguments rather than @autoclass with parameters as it is more convenient for the cases where I need to write a customise the various dunder methods for hash, dict, eq and repr. For some cases I need init, to_dict and repr to include different fields - make_init makes this easy with the usage like:

init = make_init(height)

particularly useful when subclassing makes sense and it can include fields from the parent.

What do you think about exposing the builders for hash, dict, eq, and repr rather than having them in _apply_decorator of @autoclass?

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