Advertisement
Guest User

Untitled

a guest
Feb 5th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. from collections import nametuple
  2.  
  3. """
  4. Example:
  5. >>> tag1 = TagTuple(character='tag1')
  6. >>> tag2 = TagTuple(general='tag2')
  7. >>> tag3 = TagTuple(character='tag3')
  8. >>> tag1 < tag3 # Compare with same tag type
  9. True
  10. >>> tag3 < tag2 # Compare with different tag type
  11. True
  12. """
  13.  
  14. # Tags sorted lexicographically, general > meta > character
  15. TagTuple = namedtuple('TagTuple', ['general','meta','character'])
  16. # Default to empty string for all (unset) tag types
  17. # This is to ensure sortability ('' < s for any s != '')
  18. TagTuple.__new__.__defaults__ = ('','','')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement