Hi,
I've been looking through the source code for gremlin_python and in particular the Bytecode class that has the def add_step(self, step_name, *args): method.
When it creates the instruction by iterating over the arguments, it makes a call to self.__convertArgument(arg) in which it tests for various collection types, like maps and lists, doing this:
isinstance(arg, list):
newList = []
for item in arg:
newList.append(self.__convertArgument(item))
return newList
As I know as much Python as I've managed to assimilate over the last week, that to me simply looks like it's creating a new list from the previous array literal argument. I realise that this test might be used for the unfold() step. There is similar code for dictionaries and sets among others. I can't find any other example code usage in the step reference guide where an argument passed in is a collection type, besides a complex list to unfold().
If I was reimplementing Bytecode class in a different language, would it be wise to keep this collection manipulation functionality, or is it doing this new list creating because python is python and you can't create a valid bytecode representation of collections unless you perform this conversion on them?
Thanks.