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

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

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.4.8
    • Fix Version/s: 3.5.0, 3.4.9
    • Component/s: python
    • Labels:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: