Skip to content

pycodegen: make generated objects comparable #592

@GlassOfWhiskey

Description

@GlassOfWhiskey

At the moment, objects generated by python codegen do not implement __eq__ and __hash__ methods. Therefore, equivalence and membership tests fail for two identical copies of an object. This can create some issues and unwanted behaviors, for example here.

A basic rule could be to generate __eq__ and __hash__ methods that only consider Schema SALAD fields, i.e. excluding extension_fields and loadingOptions. This should solve the majority of cases (maybe all?).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions