Forum: Poser Python Scripting


Subject: Best way to write this line?

pikusuru opened this issue on Oct 16, 2006 · 5 posts


pikusuru posted Mon, 16 October 2006 at 8:21 PM

This is probably a stupid question but I would like your advice.  What's the best way to write this?

This:

<span style="background-color:rgb(255,255,255);">self.vertices.append(map(float,l.split(' ',1)[1].split()))</span>  

or this: vertex = l.split(' ',1)[1].split()

self.vertices.append(map(float,vertex))



or this: vLine = l.split()

vertex = vLine[1:]

self.vertices.append(map(float,vertex))


They are all meant to take the a string 'v 1.0 2.0 3.0' and return a list [1.0,2.0,3.0] where each item in the list has been converted to a float.

The first obviously takes up less space but isn't as readable.  Does it matter?

Thanks.