[ 
https://issues.apache.org/jira/browse/TINKERPOP-2435?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17214989#comment-17214989
 ] 

ASF GitHub Bot commented on TINKERPOP-2435:
-------------------------------------------

spmallette opened a new pull request #1350:
URL: https://github.com/apache/tinkerpop/pull/1350


   https://issues.apache.org/jira/browse/TINKERPOP-2435
   
   Seems like less of a problem in practice as most Python users wouldn't 
improperly do g.V().__len__ but debugging tools might do such things on code 
introspection as PyCharm does with its debugger. That of course would build 
unexpected Gremlin and will typically return no values (as any traversal ending 
with values() and a key that doesnt exist will just filter out).
   
   All tests pass with `mvn clean install -pl gremlin-python`
   
   VOTE +1


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


> 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
>            Priority: Minor
>
> 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