ashb commented on code in PR #24743:
URL: https://github.com/apache/airflow/pull/24743#discussion_r910786010
##########
airflow/models/dataset.py:
##########
@@ -66,10 +68,36 @@ def __init__(self, uri: str, **kwargs):
super().__init__(uri=uri, **kwargs)
def __eq__(self, other):
+ if not isinstance(other, self.__class__):
+ return False
return self.uri == other.uri
Review Comment:
FYI it is better to do it this way so that `other` has a chance to have it's
eq fn called too:
```suggestion
if isinstance(other, self.__class__):
return self.uri == other.uri
raise NotImplemented
```
In pseudo-python, this what Python does with `a == b`:
```python
try:
return a.__eq__(b)
except NotImpelemented:
try:
return b.__eq__(a)
except NotImpelemented:
return False
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]