I want to use a heap queue (http://docs.python.org/2/library/heapq.html) on a class I made in python:
class Dog:
def __init__(self, name, age):
self.name = name
self.age = age
I want to compare the dogs by age in the heap queue. How do I tell python to compare my objects by age? In other words, can I somehow write a "comparator" in python?