[Tutor] Better structure?
jeff at ccvcorp.com
Wed Feb 2 03:37:00 CET 2005
Jacob S. wrote:
> So, how would one go about this in a non broken code way? Don't they
> have something like what I'm requesting.
No, but it's pretty easy to do:
def exact_lstrip(astring, stripstring):
astring = astring[len(stripstring):]
> [...] Also why
> shouldn't string methods include stuff like lstrip which do precisely
> what I request?
Maybe it's because other people would have different expectations?
The current implementation of strip() (including lstrip() and
rstrip()) seems to work well for the most common case, and I'm not
sure that your expectation is necessarily more generally useful than
the current behavior. Especially given that your behavior is the one
that's easier to hand-code if it's desired.
More information about the Tutor