Actually you want to use append
(instead of extend
) since, in this example, we’re using it to add a single object (that object being a tuple
).
To make it more clear you can write:
input_point = point, name
input_points.append(input_point)
…which is equivalent to:
input_points.append((point, name))
…where input_point
is the tuple.
Basically a tuple is a way to pack more than one object (eg, point
and name
) into a single object. By the way, both input_point = point, name
and input_point = (point, name)
are the same in Python. As are for point, name in input_points
and for (point, name) in input_points
. But with input_points.append((point, name))
you need the parentheses, otherwise Python thinks you’re calling append(point, name)
which is calling append()
with two arguments/objects instead of one and you get the error you encountered.
And sorry, in my previous post I had made a typo (fixed now) where I had:
input_points.append((pygplates.PointOnSphere(lat, lon), name, description)
…when I should have had:
input_points.append((pygplates.PointOnSphere(lat, lon), name, description))
…note the extra )
at the end.
Regards,
John