da2a11adf9
This reverts commit 0494a36681
.
14 lines
311 B
Python
Executable file
14 lines
311 B
Python
Executable file
from operator import attrgetter
|
|
|
|
|
|
def ranker(iterable, key=attrgetter("points"), rank=0):
|
|
delta = 1
|
|
last = None
|
|
for item in iterable:
|
|
new = key(item)
|
|
if new != last:
|
|
rank += delta
|
|
delta = 0
|
|
delta += 1
|
|
yield rank, item
|
|
last = key(item)
|