Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as Python by RyszardSzopa ( 17 years ago )
def _get_taglike(self, taglike):
        try:
            # this won't work in < 2.6
            current_tags = set().union(*(getattr(record, taglike) for record in self.records))
        except TypeError:
            # in <= 2.5
            current_tags = set()
            for record in self.records:
                current_tags.update(getattr(record, taglike))
        t = [(len(getattr(self, '_'+taglike)[tag]), tag) for tag in current_tags]
        return sorted(t, reverse=True)[:30]

 

Revise this Paste

Your Name: Code Language: