[Python-ideas] string codes & substring equality

Chris Angelico rosuav at gmail.com
Thu Nov 28 00:30:23 CET 2013


On Thu, Nov 28, 2013 at 9:28 AM, Ethan Furman <ethan at stoneleaf.us> wrote:
> On 11/27/2013 01:34 PM, spir wrote:
>>
>> On 11/27/2013 09:01 PM, Paul Moore wrote:
>>>
>>> On 27 November 2013 17:59, MRAB <python at mrabarnett.plus.com> wrote:
>>>>
>>>>
>>>> --> help(str.startswith)
>>>>
>>>> Help on method_descriptor:
>>>>
>>>> startswith(...)
>>>>      S.startswith(prefix[, start[, end]]) -> bool
>>>
>>>
>>> Wow! I never knew that startswith/endswith accepted start and end
>>> arguments. Something new I learned today - thanks :-)
>>
>>
>> You're not the only one ;-) I learnt it yesterday. Probably the method
>> name misleads (not only you and i?.
>
>
> What's misleading about it?  And how hard is it to look it up in the docs
> (or help)?  That's what I do when I'm going to use something I haven't
> before.

If I want to know if this bit of this string matches that bit of that
string, I'm not going to look at startswith, unless I already know
that it has this functionality - which until today I didn't. When
would I go to look it up in the docs? Am I going to check
help("".upper) to see if it can also convert digits to superscript?

ChrisA


More information about the Python-ideas mailing list