mirror of
https://github.com/python/cpython.git
synced 2025-07-22 02:35:22 +00:00
Use decorators.
This commit is contained in:
parent
9ba3684ecc
commit
75b64e65f1
3 changed files with 8 additions and 15 deletions
|
@ -63,12 +63,12 @@ class UserDict:
|
|||
return self.data.popitem()
|
||||
def __contains__(self, key):
|
||||
return key in self.data
|
||||
@classmethod
|
||||
def fromkeys(cls, iterable, value=None):
|
||||
d = cls()
|
||||
for key in iterable:
|
||||
d[key] = value
|
||||
return d
|
||||
fromkeys = classmethod(fromkeys)
|
||||
|
||||
class IterableUserDict(UserDict):
|
||||
def __iter__(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue