Stephen Mallette created TINKERPOP-2435:
-------------------------------------------

             Summary: Gremlin Python sugar syntax for values() can lead to 
unexpected problems
                 Key: TINKERPOP-2435
                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2435
             Project: TinkerPop
          Issue Type: Bug
          Components: python
    Affects Versions: 3.4.8
            Reporter: Stephen Mallette


This issue was originally brought up on Gremlin Users:

https://groups.google.com/g/gremlin-users/c/GRbsqJ-2t_E/m/IaWCOdGyCAAJ

but in summary there is an issue with {{GraphTraversal.__getattr__}} which 
provides sugar for {{values(key)}}. It works fine except that PyCharm debugger 
introspects by way of {{__len__}} which then calls {{values("__len__")}} and 
alters the traversal. It is fixed with something like:

{code}
    def __getattr__(self, key):
        if key == '__len__':
            raise AttributeError("nope")
        return self.values(key)
{code}

but I'm not sure if that's the best fix for this issue.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to