On Sun, Mar 04, 2018 at 01:44:20PM -0500, Clint Hepner wrote:

> -1. I see no compelling reason to overload __getitem__ to provide a synonym 
> for the split method. 
> 
>     eggs = "wiki." + spam.split('.')[1:]

Fair point. Neither do I. But your next comment:

> Besides, you can already make such replacements more efficiently with
> 
>     eggs = spam.replace('docs', 'wiki')

is not suitable, because it assumes that the substring "docs" appears 
only once in the string.

In a more realistic example, you don't know what the string contains, 
only that it is delimited by dots and that you want to replace the n-th
field (whatever it contains) with "wiki".



-- 
Steve
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to