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
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