Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-2435

Gremlin Python sugar syntax for values() can lead to unexpected problems

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.4.8
    • 3.5.0, 3.4.9
    • python
    • None

    Description

      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:

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

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

      Attachments

        Activity

          People

            spmallette Stephen Mallette
            spmallette Stephen Mallette
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: