remove obsolete names and consistently quote strings (#1343)
This commit is contained in:
parent
68062417c0
commit
f53a04ea30
|
@ -88,7 +88,7 @@ may use the constant-time behavior of comparing the lengths of
|
|||
the original and new strings::
|
||||
|
||||
>>> string = 'Python String Input'
|
||||
>>> new_string = string.removeprefix("Py")
|
||||
>>> new_string = string.removeprefix('Py')
|
||||
>>> modified = (len(string) != len(new_string))
|
||||
>>> modified
|
||||
True
|
||||
|
@ -235,7 +235,7 @@ from the proposed behavior via by the following::
|
|||
|
||||
>>> s = 'Foo' * 100 + 'Bar'
|
||||
>>> prefix = 'Foo'
|
||||
>>> while len(s) != len(s := s.cutprefix(prefix)): pass
|
||||
>>> while len(s) != len(s := s.removeprefix(prefix)): pass
|
||||
>>> s
|
||||
'Bar'
|
||||
|
||||
|
@ -243,7 +243,7 @@ or the more obvious and readable alternative::
|
|||
|
||||
>>> s = 'Foo' * 100 + 'Bar'
|
||||
>>> prefix = 'Foo'
|
||||
>>> while s.startswith(prefix): s = s.cutprefix(prefix)
|
||||
>>> while s.startswith(prefix): s = s.removeprefix(prefix)
|
||||
>>> s
|
||||
'Bar'
|
||||
|
||||
|
|
Loading…
Reference in New Issue