ahmedabu98 commented on code in PR #35696:
URL: https://github.com/apache/beam/pull/35696#discussion_r2257670391


##########
sdks/python/apache_beam/pvalue.py:
##########
@@ -675,11 +676,15 @@ def __hash__(self):
     return hash(self.__dict__.items())
 
   def __eq__(self, other):
+    if type(self) == type(other):
+      other_dict = other.__dict__
+    elif type(other) == type(NamedTuple):
+      other_dict = other._asdict()
+    else:
+      return False
     return (
-        type(self) == type(other) and
-        len(self.__dict__) == len(other.__dict__) and all(
-            s == o
-            for s, o in zip(self.__dict__.items(), other.__dict__.items())))
+        len(self.__dict__) == len(other_dict) and
+        all(s == o for s, o in zip(self.__dict__.items(), other_dict.items())))

Review Comment:
   Ahh I think the problem described in #35790 is because this handles 
top-level NamedTuples. Should be a straightforward fix but not a blocker for 
this PR



-- 
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: github-unsubscr...@beam.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to