wolverdude / GenSON

GenSON is a powerful, user-friendly JSON Schema generator built in Python.
MIT License
584 stars 64 forks source link

A more optimal way to do __eq__ #29

Closed YehudaCorsia closed 4 years ago

YehudaCorsia commented 5 years ago

Hey, i saw that you search for more optimal way to do __eq__ in SchemaNode and i am also saw that you use not optimal way in SchemaBuilder

and also in SchemaNode you do return self.to_schema() == other.to_schema() and to_schema() is big function that might take a lot of time.

i am think have a better solution that you can use:


def __eq__(self, other):
    return (isinstance(other, self.__class__) and
           self.__dict__ == other.__dict__)
YehudaCorsia commented 5 years ago

I just created a pull request with the new code...

wolverdude commented 4 years ago

This should be updated in the next release.

wolverdude commented 4 years ago

Fixed in v1.2.0