Hello everyone,

I was reading through the gremlin_python GLV code this morning, and
overall it looks like it should work pretty smoothly. Thanks for doing
this Marko, really cool work! I just wanted to comment on a few things
that popped out at me on my first reading.The major issue I see is
that it is not currently Python 2/3 compatible. This is due to two
things:

1. The way iterators are implemented in Python 2/3 is different. This
problem could be remedied by adding a method to
``PythonGraphTraversal``, something like:

def __next__(self):
    return self.next()

then, in the ``next`` method, changing line 113 to
``next(self.results)``, should take care of this problem.

2. The ``GroovyTranslator`` class checks for type ``long``, this no
longer exists in Python 3. Determining what to submit as a Long might
require some discussion, but this could be easily fixed by adding
something like:

import sys
if sys.version_info.major > 2:
    long = int

to the top of the file.

Other than this, there are some minor details that could be cleaned
up. Particularly:

1. Using ``isinstance`` instead of ``type`` to perform type checking.
This will recognize subclasses and is the most Pythonic way to do
this.

2. Formatting - indents, and line spacing. Typically, Python methods
are separated by a single line, and indents use four spaces. This is
really just cosmetic for readability.

3. CamelCase vs. underscores. I understand that to emulate Gremlin,
the traversal methods etc. should use CamelCase. But I wonder if the
helper classes (Translators) should use the Python convention of using
underscores to name methods. Python class names use camel case by
convention.

Finally, the implementation of the B class may need some work, but
we'll have to play around with it a bit to figure out how the best
approach to doing this.

I'm sure there are more improvements, but I just wanted to get a
conversation going. I would be happy to make a PR with some of these
changes.

Also, gremlinclient will soon support the RemoteConnection interface,
I'll send out a link to the docs once I get everything up and running.

Thanks again to everyone at TInkerpop for all the hard work!

Best,

Dave

-- 
David M. Brown
R.A. CulturePlex Lab, Western University

Reply via email to