Re: PEP 616 "String methods to remove prefixes and suffixes" accepted

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
participants (1)
-
Raymond Hettinger