A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/1999-June/095421.html below:

[Python-Dev] String methods... finally

[Python-Dev] String methods... finally [Python-Dev] String methods... finallyKa-Ping Yee ping at lfw.org
Sat Jun 12 10:05:06 CEST 1999
On Fri, 11 Jun 1999, Fredrik Lundh wrote:
> > Two new methods startswith and endswith act like their Java cousins.
> 
> is it just me, or do those method names suck?
> 
> begin?  starts_with?  startsWith? (ouch)
> has_prefix?

I'm quite happy with "startswith" and "endswith".  I mean,
they're a bit long, i suppose, but i can't think of anything
better.  You definitely want to avoid has_prefix, as that
compounds the has_key vs. hasattr issue.

    x.startswith("foo")
    x[:3] == "foo"

    x.startswith(y)
    x[:len(y)] == y

Hmm.  I guess it doesn't save you much typing until y is an
expression.  But it's still a lot easier to read.



!ping



More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4