Skip to content
Discussion options

You must be logged in to vote

It would be wrong to say that those are equal, by default, as from_data does not have id, whereas from_db does have it.

If you want, you can however define the equality check how you want, by overriding __eq__,https://docs.python.org/3/reference/datamodel.html#object.__eq__

It might be confusing to make non-equal objects equal, though, so perhaps for your purpose you want some new method, like from_data.has_same_data(from_db) or maybe better has_same_data(from_data, from_db) .. perhaps content_equals() ?

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by YuriiMotov
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
3 participants