On 3/22/2020 12:25 PM, Paul Ganssle wrote:
Sorry, I think I accidentally left out a clause here - I meant that
the rationale for /always returning a 'str'/ (as opposed to returning
a subclass) is missing, it just says in the PEP:
The only difference between the real implementation and the above is
that, as with other string methods like replace, the methods will
raise a TypeError if any of self, pre or suf is not an instace of
str, and will cast subclasses of str to builtin str objects.
I think the rationale for these differences is not made entirely
clear, specifically the "and will cast subclasses of str to builtin
str objects" part.
Agreed. I don't understand the rationale, either. If we stick with it,
it should definitely be stated. And if we don't, that reason should be
explained, too.
Eric
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/python-dev@python.org/message/B4AGI7TJU5HC7VMYEO7VK63LTDMU7Q4M/
Code of Conduct: http://python.org/psf/codeofconduct/