Дятлинко Екатерина Сергеевна, 530 группа StrictSort 1542
Матвеев Алексей Дмитриевич, 623 группа StrictSort 1586
f1from collections.abc import MutableSequence, Sized, Callablef1from collections.abc import MutableSequence, Sized, Callable
2from typing import Protocol, Any2from typing import Protocol, Any
33
4class Comparable(Protocol):4class Comparable(Protocol):
55
6    def __lt__(self, other: Any) -> bool:6    def __lt__(self, other: Any) -> bool:
7        pass7        pass
8Sortable = MutableSequence[Comparable]8Sortable = MutableSequence[Comparable]
99
10def defkey(element: Comparable) -> Comparable:10def defkey(element: Comparable) -> Comparable:
11    if isinstance(element, Sized):11    if isinstance(element, Sized):
12        return len(element)12        return len(element)
tt13    else:
13    return element14        return element
1415
15def strictsort(seq: Sortable, key: Callable[[Comparable], Comparable]=de16def strictsort(seq: Sortable, key: Callable[[Comparable], Comparable]=de
>fkey) -> Sortable:>fkey) -> Sortable:
16    return sorted(seq, key=key)17    return sorted(seq, key=key)
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op