Closed jakebeal closed 3 years ago
If I were to define a list, as your example does, I would probably:
error_list = list(c.members)
If I were to add elements from a list of referenced objects to an existing list I would probably:
error_list = []
error_list.extend(c.members)
You can do it your way if you do it like this:
error_list = [] + list(c.members)
But I don't know why you'd use concatenation with an empty list to set a variable. I would instead use my first example above.
Ah, thank you; in my python naivete I didn't realize that list(x)
was a conversion rather than equivalent to [x]
.
To the question of empty list... that's just the minimal error example; in practice, I'm actually collecting together lists based on several different properties in the process of expanding a CombinatorialDerivation
.
I'm collecting together the values from some list-valued properties, and it seems awkward that we can't add together ReferencedObjectLists. Is there a recommended way to convert them into normal lists, for such purposes?
Minimal example, with both error and (ugly) workaround: