[Python-ideas] string codes & substring equality

Chris Angelico rosuav at gmail.com
Thu Nov 28 05:02:00 CET 2013


On Thu, Nov 28, 2013 at 10:52 AM, Ethan Furman <ethan at stoneleaf.us> wrote:
> On 11/27/2013 03:30 PM, Chris Angelico wrote:
>>
>>
>> Am I going to check help("".upper) to see if it can
>>  also convert digits to superscript?
>
>
> Heh, that would be cool.
>
> I retract (most of) my comment.  start(end)swith is certainly not an obvious
> name for something that can also do random substring comparisons.
>
> Personally, I do search the docs when looking for functionality I don't know
> about.  As there is no obvious substring method I would check the docs for
> all the string methods to see if any of them had any thing close to, or
> exactly, what I needed.
>
> But, hey, maybe that's just me.  :)

Yeah, that would be one good way to do it. But do you need a
"substring comparison" method, or do you simply extract a substring
and compare it (which is done with slicing)? Sometimes you don't need
a single named way to do exactly what you want[1], you should just
build from primitives.

ChrisA

[1] http://php.net/manual/en/function.gzgetss.php - why does this exist?


More information about the Python-ideas mailing list