mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-04 21:50:54 +03:00
Slightly simplify Image.__eq__
Two identical types can be compared using the `is` operator. Object identity is slightly faster than a string comparison as well.
This commit is contained in:
parent
168e51751e
commit
dd1e7ccc4a
|
@ -655,8 +655,7 @@ class Image(object):
|
||||||
return filename
|
return filename
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return (isinstance(other, Image) and
|
return (self.__class__ is other.__class__ and
|
||||||
self.__class__.__name__ == other.__class__.__name__ and
|
|
||||||
self.mode == other.mode and
|
self.mode == other.mode and
|
||||||
self.size == other.size and
|
self.size == other.size and
|
||||||
self.info == other.info and
|
self.info == other.info and
|
||||||
|
|
Loading…
Reference in New Issue
Block a user