remove obsolete names and consistently quote strings (#1343)

This commit is contained in:
sweeneyde 2020-03-27 12:39:16 -04:00 committed by GitHub
parent 68062417c0
commit f53a04ea30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -88,7 +88,7 @@ may use the constant-time behavior of comparing the lengths of
the original and new strings:: the original and new strings::
>>> string = 'Python String Input' >>> string = 'Python String Input'
>>> new_string = string.removeprefix("Py") >>> new_string = string.removeprefix('Py')
>>> modified = (len(string) != len(new_string)) >>> modified = (len(string) != len(new_string))
>>> modified >>> modified
True True
@ -235,7 +235,7 @@ from the proposed behavior via by the following::
>>> s = 'Foo' * 100 + 'Bar' >>> s = 'Foo' * 100 + 'Bar'
>>> prefix = 'Foo' >>> prefix = 'Foo'
>>> while len(s) != len(s := s.cutprefix(prefix)): pass >>> while len(s) != len(s := s.removeprefix(prefix)): pass
>>> s >>> s
'Bar' 'Bar'
@ -243,7 +243,7 @@ or the more obvious and readable alternative::
>>> s = 'Foo' * 100 + 'Bar' >>> s = 'Foo' * 100 + 'Bar'
>>> prefix = 'Foo' >>> prefix = 'Foo'
>>> while s.startswith(prefix): s = s.cutprefix(prefix) >>> while s.startswith(prefix): s = s.removeprefix(prefix)
>>> s >>> s
'Bar' 'Bar'