mirror of
https://github.com/python/cpython.git
synced 2025-11-25 12:44:13 +00:00
Small code simplification. Forgot that classmethods can be called from intances.
This commit is contained in:
parent
eb94d4c3e3
commit
1166872006
2 changed files with 2 additions and 2 deletions
|
|
@ -410,7 +410,7 @@ Example::
|
|||
|
||||
def _replace(self, **kwds):
|
||||
'Return a new Point object replacing specified fields with new values'
|
||||
result = self.__class__._make(map(kwds.pop, ('x', 'y'), self))
|
||||
result = self._make(map(kwds.pop, ('x', 'y'), self))
|
||||
if kwds:
|
||||
raise ValueError('Got unexpected field names: %r' % kwds.keys())
|
||||
return result
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ def namedtuple(typename, field_names, verbose=False):
|
|||
return {%(dicttxt)s} \n
|
||||
def _replace(self, **kwds):
|
||||
'Return a new %(typename)s object replacing specified fields with new values'
|
||||
result = self.__class__._make(map(kwds.pop, %(field_names)r, self))
|
||||
result = self._make(map(kwds.pop, %(field_names)r, self))
|
||||
if kwds:
|
||||
raise ValueError('Got unexpected field names: %%r' %% kwds.keys())
|
||||
return result \n\n''' % locals()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue