[Python-Dev] Re: PEP 616 "String methods to remove prefixes and suffixes" accepted

2020-04-20 Thread Raymond Hettinger
Please consider adding underscores to the names:  remove_prefix() and 
remove_suffix().

The latter method causes a mental hiccup when first read as removes-uffix, 
forcing mental backtracking to get to remove-suffix. We had a similar problem 
with addinfourl initially being read as add-in-four-l before mentally 
backtracking to add-info-url.

The PEP says this alternative was considered, but I disagree with the rationale 
given in the PEP.  The reason that "startswith" and "endswith" don't have 
underscores is that they aren't needed to disambiguate the text.  Our rules are 
to add underscores and to spell-out words when it improves readability, which 
in this case it does.   Like casing conventions, our rules and preferences for 
naming evolved after the early modules were created -- the older the module, 
the more likely that it doesn't follow modern conventions.

We only have one chance to get this right (bugs can be fixed, but API choices 
persist for very long time).  Take it from someone with experience with this 
particular problem.  I created imap() but later regretted the naming pattern 
when if came to ifilter() and islice() which sometimes cause mental hiccups 
initially being read as if-ilter and is-lice.


Raymond
___
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/ZMXSQ5T6L6CR5GUIBFEYLJJF7FE4B4US/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: PEP 616 "String methods to remove prefixes and suffixes" accepted

2020-04-20 Thread Guido van Rossum
Congrats Dennis! I hope your PR lands soon.

On Mon, Apr 20, 2020 at 12:40 PM Eric V. Smith  wrote:

> Congratulations, Dennis!
>
> Not 10 minutes ago I was writing code that could have used this
> functionality. And I got it wrong on my first attempt! I'm looking
> forward to it in 3.9.
>
> Eric
>
> On 4/20/2020 2:26 PM, Victor Stinner wrote:
> > Hi,
> >
> > The Python Steering Council accepts the PEP 616 "String methods to
> > remove prefixes and suffixes":
> > https://www.python.org/dev/peps/pep-0616/
> >
> > Congrats Dennis Sweeney!
> >
> > We just have one last request: we expect the documentation to explain
> > well the difference between removeprefix()/removesuffix() and
> > lstrip()/strip()/rstrip(), since it is the rationale of the PEP ;-)
> >
> > You can find the WIP implementation at:
> >
> > * https://github.com/python/cpython/pull/18939
> > * https://bugs.python.org/issue39939
> >
> > Victor
> ___
> 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/VV2CFGYTJXADLK5NJXECU55HS5PYNUK3/
> Code of Conduct: http://python.org/psf/codeofconduct/
>


-- 
--Guido van Rossum (python.org/~guido)
*Pronouns: he/him **(why is my pronoun here?)*

___
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/IQMXG57KDF4G62KKWKXAXKNYSAU7IE5G/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: PEP 616 "String methods to remove prefixes and suffixes" accepted

2020-04-20 Thread Eric V. Smith

Congratulations, Dennis!

Not 10 minutes ago I was writing code that could have used this 
functionality. And I got it wrong on my first attempt! I'm looking 
forward to it in 3.9.


Eric

On 4/20/2020 2:26 PM, Victor Stinner wrote:

Hi,

The Python Steering Council accepts the PEP 616 "String methods to
remove prefixes and suffixes":
https://www.python.org/dev/peps/pep-0616/

Congrats Dennis Sweeney!

We just have one last request: we expect the documentation to explain
well the difference between removeprefix()/removesuffix() and
lstrip()/strip()/rstrip(), since it is the rationale of the PEP ;-)

You can find the WIP implementation at:

* https://github.com/python/cpython/pull/18939
* https://bugs.python.org/issue39939

Victor

___
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/VV2CFGYTJXADLK5NJXECU55HS5PYNUK3/
Code of Conduct: http://python.org/psf/codeofconduct/