title: Can I sort a list of objects by 2 keys?
body: <p>I have the following class (trimmed down):</p>
  
  <pre><code>class DiskInstance(object):
  
      def __init__(self, name, epoch, size)
          self.name   = name
          self.epoch  = epoch
          self.size   = size
  </code></pre>
  
  <p>Then I define a external function (external to the class above):</p>
  
  <pre><code>def getepoch(object):
      return object.epoch
  </code></pre>
  
  <p>I then instantiate several objects of this class and append to a list called DISKIMAGES.</p>
  
  <p>I am currently sorting like this:</p>
  
  <pre><code>for image in sorted(DISKIMAGES, key=getedate, reverse=True):
  </code></pre>
  
  <p>Is there any way I can sort first by getedate and then by size?</p>
  
  <p>Thx for any help.</p>