Skip to content

Commit

Permalink
Update pydantic/main.py
Browse files Browse the repository at this point in the history
Co-authored-by: David Montague <35119617+dmontagu@users.noreply.github.com>
  • Loading branch information
QuentinSoubeyranAqemia and dmontagu committed Nov 13, 2023
1 parent e84498a commit 2f90197
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pydantic/main.py
Expand Up @@ -931,7 +931,7 @@ def __eq__(self, other: Any) -> bool:
# Resort to costly filtering of the __dict__ objects
# We use operator.itemgetter because it is much faster than dict comprehensions
# NOTE: Contrary to standard python class and instances, when the Model class has a default value for an
# attribute and the model instance doesn't have a corresponding attribute, accessing the missing attribute
# attribute and the model instance doesn't have a corresponding attribute, accessing the missing attribute
# raises an error in BaseModel.__getattr__ instead of returning the class attribute
# So we can use operator.itemgetter() instead of operator.attrgetter()
getter = operator.itemgetter(*model_fields) if model_fields else lambda _: _SENTINEL
Expand Down

0 comments on commit 2f90197

Please sign in to comment.