Results 1 to 2 of 2

Thread: how to implement sorting on custom Python class?

  1. #1
    Join Date
    Aug 2006
    Beans
    102

    Question how to implement sorting on custom Python class?

    Here is my custom class, they will be used to build up more complex objects

    Code:
    class RIMSheet:
        def __init__(self, PageNum, PageName):
            """
            This DocString is returned by calling help
            """
            self.PageNum = int(PageNum)
            self.PageName = PageName
        def getPageName(self):
            return self.pageName
        def getPageNum(self):
            return str(self.PageNum)
    if i have a list of these sheets, i want to be able to sort the list based on PageNum.
    How do i enable that?
    Last edited by fokuslee; October 11th, 2012 at 03:44 PM.

  2. #2
    Join Date
    Nov 2005
    Location
    Bordeaux, France
    Beans
    11,292
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: how to implement sorting on custom Python class?

    「明後日の夕方には帰ってるからね。」


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •