On Wed, Mar 25, 2020 at 5:42 PM Dennis Sweeney <sweeney.dennis...@gmail.com> wrote:
> I'm removing the tuple feature from this PEP. So now, if I understand > correctly, I don't think there's disagreement about behavior, just about > how that behavior should be summarized in Python code. > [...] > return (the original object unchanged, or a copy of the object, > depending on implementation details, > but always make a copy when working with subclasses) > > is well-summarized by > > return self[:] > > especially if followed by the text > > Note that ``self[:]`` might not actually make a copy -- if the affix > is empty or not found, and if ``type(self) is str``, then these methods may, but are not required to, make the optimization of returning > ``self``. > However, when called on instances of subclasses of ``str``, these > methods should return base ``str`` objects, not ``self``. > > Perhaps: Note that ``self[:]`` might not actually make a copy of ``self``. If the affix is empty or not found, and if ``type(self)`` is immutable, then these methods may, but are not required to, make the optimization of returning ``self``. ... [...] >
_______________________________________________ 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/UWIFAGIT6CKVYGWOCWHAUNFCVSS6TJ3X/ Code of Conduct: http://python.org/psf/codeofconduct/