On Wed, Jun 13, 2018 at 3:54 PM MRAB <pyt...@mrabarnett.plus.com> wrote:

> Would it check first-to-last or longest-to-shortest? I think that
> longest-to-shortest would be the most useful.
>
>  >>> old = ('cat', 'cats')
>  >>> new = ('mouse', 'mice')
>  >>>
>  >>> # First-to-last.
>  >>> 'cats'.replace(old, new)
> 'mouses'
>  >>>
>  >>> # Longest-to-shortest.
>  >>> 'cats'.replace(old, new)
> 'mice'
>

​I would expect left-to-right, and leave the programmer to get their mouse
in order.​
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to