Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from collections import nametuple
- """
- Example:
- >>> tag1 = TagTuple(character='tag1')
- >>> tag2 = TagTuple(general='tag2')
- >>> tag3 = TagTuple(character='tag3')
- >>> tag1 < tag3 # Compare with same tag type
- True
- >>> tag3 < tag2 # Compare with different tag type
- True
- """
- # Tags sorted lexicographically, general > meta > character
- TagTuple = namedtuple('TagTuple', ['general','meta','character'])
- # Default to empty string for all (unset) tag types
- # This is to ensure sortability ('' < s for any s != '')
- TagTuple.__new__.__defaults__ = ('','','')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement