Message364028
Yes:
>>> x = "A"*10**6
>>> x.cutprefix("B") is x
True
>>> x.cutprefix("") is x
True
>>> y = b"A"*10**6
>>> y.cutprefix(b"B") is y
True
>>> y.cutprefix(b"") is y
True
>>> z = bytearray(b"A")*10**6
>>> z.cutprefix(b"B") is z
False
>>> z.cutprefix(b"") is z
False
I'm not sure whether this should be part of the spec or an implementation detail. The (str/bytes).replace method docs don't clarify this, but they have the same behavior:
>>> x = "A"*10**6
>>> x.replace("B", "C") is x
True
>>> x.replace("", "") is x
True
>>> y = b"A"*10**6
>>> y.replace(b"B", b"C") is y
True
>>> y.replace(b"", b"") is y
True
>>> z = bytearray(b"A")*10**6
>>> z.replace(b"B", b"C") is z
False
>>> z.replace(b"", b"") is z
False |
|
Date |
User |
Action |
Args |
2020-03-12 16:37:24 | Dennis Sweeney | set | recipients:
+ Dennis Sweeney, vstinner, eric.smith, steven.daprano, xtreak |
2020-03-12 16:37:24 | Dennis Sweeney | set | messageid: <1584031044.93.0.316773368506.issue39939@roundup.psfhosted.org> |
2020-03-12 16:37:24 | Dennis Sweeney | link | issue39939 messages |
2020-03-12 16:37:24 | Dennis Sweeney | create | |
|