Brian Elmegaard wrote: > "Matt Hammond" <[EMAIL PROTECTED]> writes: > > >>y_max = max([e.x for e in y]) > > > Would there be a way to refer back to the e with maximum x, or how > could I find other attributes of it?
In that case a common idiom is to "decorate" decorated = [(obj.x, obj) for obj in objects] max_decorated = max(decorated) max_obj = max_decorated[-1] Or to run through it "old style" max_obj = objects[0] for obj in objects: if obj.x > max_obj.x: max_obj = obj Readbility is about the same I think. Testing should tell you which is faster in your case. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list