Getting the max value of attributes from a list of objects
There's a built-in to help with this case.
import operator
print(max(path.nodes, key=operator.attrgetter('y')))
Alternatively:
print(max(path.nodes, key=lambda item: item.y))
Edit: But Mark Byers' answer is most Pythonic.
print(max(node.y for node in path.nodes))
To get just the maximum value and not the entire object you can use a generator expression:
print(max(node.y for node in path.nodes))