[ 
https://issues.apache.org/jira/browse/BEAM-4007?focusedWorklogId=111799&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-111799
 ]

ASF GitHub Bot logged work on BEAM-4007:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 14/Jun/18 07:14
            Start Date: 14/Jun/18 07:14
    Worklog Time Spent: 10m 
      Work Description: tvalentyn commented on a change in pull request #5337: 
[BEAM-4007] Futurize typehints subpackage
URL: https://github.com/apache/beam/pull/5337#discussion_r195321725
 
 

 ##########
 File path: sdks/python/apache_beam/typehints/typehints.py
 ##########
 @@ -411,17 +416,23 @@ def __eq__(self, other):
   def __repr__(self):
     return 'Any'
 
+  def __hash__(self):
+    return hash(id(self))
+
   def type_check(self, instance):
     pass
 
 
 class TypeVariable(AnyTypeConstraint):
 
+  def __init__(self, name):
+    self.name = name
+
   def __eq__(self, other):
     return type(self) == type(other) and self.name == other.name
 
-  def __init__(self, name):
-    self.name = name
+  def __hash__(self):
 
 Review comment:
   I reproduced the BEAM-3730 but could not easily interpret the failure mode. 
It is clear that equality relationship is not defined correctly here. I'd like 
to understand the failure first to understand what assumptions Beam codebase 
has about typehints. I don't have a good answer right now. For the purpose of 
this change, I think keeping `hash(id(self))` is ok for now since we won't make 
things more broken with that, but we should add a TODO(BEAM-3730): Fix the 
contract between `__hash__` and `eq`. I'll try to add more context to the issue 
later.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 111799)
    Time Spent: 1h 40m  (was: 1.5h)

> Futurize and fix python 2 compatibility for typehints subpackage
> ----------------------------------------------------------------
>
>                 Key: BEAM-4007
>                 URL: https://issues.apache.org/jira/browse/BEAM-4007
>             Project: Beam
>          Issue Type: Sub-task
>          Components: sdk-py-core
>            Reporter: Robbe
>            Assignee: Robbe
>            Priority: Major
>          Time Spent: 1h 40m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to