On 30/08/2018 07:41, Andrea Thorn wrote:
Apply() could be replaced with map(function, list) in python.


for idx_pair in idx_list:
   print idx_pair
   # the following is inelegant, what is the python equivalent of apply?
   to_generic_object_add_line(a, "green", 2,
                              coords[idx_pair[0]][0],
                              coords[idx_pair[0]][1],
                              coords[idx_pair[0]][2],
                              coords[idx_pair[1]][0],
                              coords[idx_pair[1]][1],
                              coords[idx_pair[1]][2])

For the record, this is what I had in mind:

for idx_pair in idx_list:
   l1 = [coords[idx_pair[0]][i] for i in range(3)]
   l2 = [coords[idx_pair[1]][i] for i in range(3)]
   args = [a, "green", 2] + l1 + l2
   to_generic_object_add_line(*args)

Paul

########################################################################

To unsubscribe from the COOT list, click the following link:
https://www.jiscmail.ac.uk/cgi-bin/webadmin?SUBED1=COOT&A=1

Reply via email to