← Back to team overview

yade-users team mailing list archive

[Question #254558]: Sorting a list

 

New question #254558 on Yade:
https://answers.launchpad.net/yade/+question/254558

At one point in my code, I need to sort a list of bodies from least to greatest x-coordinate. I have attempted to use the sorted() method but am not quite sure what I would use as my "key". I know State.pos[0] store the x-coordinate, but when I try to use
key=State.pos[0] 
(or, it seems, any variant thereof) I get the following error.
TypeError: 'property' object has no attribute '__getitem__'

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.