zope.sequencesort API

Advanced sort support

e.g .Sort(sequence, ((“akey”, “nocase”), (“anotherkey”, “cmp”, “desc”)))

zope.sequencesort.ssort.sort(sequence, sort=(), _=None, mapping=0)[source]

Return a sorted copy of ‘sequence’.

Parameters:
  • sequence – is a sequence of objects to be sorted
  • sort

    is a sequence of tuples (key,func,direction) that define the sort order:

    • key is the name of an attribute to sort the objects by
    • func is the name of a comparison function. This parameter is optional

      allowed values:

      • ”cmp” – the standard comparison function (default)
      • ”nocase” – case-insensitive comparison
      • ”strcoll” or “locale” – locale-aware string comparison
      • ”strcoll_nocase” or “locale_nocase” – locale-aware case-insensitive
        string comparison
      • ”xxx” – a user-defined comparison function
    • direction defines the sort direction for the key (optional). (allowed values: “asc” (default) , “desc”)