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):
    if astring.startswith(stripstring):
        astring = astring[len(stripstring):]
    return astring


[...] 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.

Jeff Shannon
Technician/Programmer
Credit International



_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to