diff options
Diffstat (limited to 'Lib/UserList.py')
-rw-r--r-- | Lib/UserList.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/UserList.py b/Lib/UserList.py index 072f6a7327..e8fd356adb 100644 --- a/Lib/UserList.py +++ b/Lib/UserList.py @@ -78,6 +78,11 @@ class UserList: def index(self, item, *args): return self.data.index(item, *args) def reverse(self): self.data.reverse() def sort(self, *args, **kwds): self.data.sort(*args, **kwds) + def sorted(cls, iterable, *args, **kwds): + s = cls(iterable) + s.sort(*args, **kwds) + return s + sorted = classmethod(sorted) def extend(self, other): if isinstance(other, UserList): self.data.extend(other.data) |