[Tutor] Better structure?

Jacob S. keridee at jayco.net
Wed Feb 2 03:23:10 CET 2005

So, how would one go about this in a non broken code way? Don't they have 
something like what I'm requesting.
It seems to me that a few things are flawed in the standard distribution. 
Little things like the overlooking of adding a method or function to decimal 
for returning an instance with x places right of the decimal. I know of 
quantize, but that's junk and not simple. Also why shouldn't string methods 
include stuff like lstrip which do precisely what I request?
Maybe because they don't want to bother putting

def mylstrip(string,stripstring):
    return string[len(stripstring):]

as a method or something?
Messy, just plain messy.

Jacob Schmidt

> Jacob S. wrote:
>> I don't know who's going crazy here... but I checked that straight from 
>> the python 2.4 interpreter...
> >>> a = "go on long buddy"
> >>> a.lstrip('gonl')
> ' on long buddy'
> >>> a.lstrip('gonl ')
> 'buddy'
> >>>
> Note that in the second case, I've included a space in the lstrip() 
> parameter.  lstrip() is essentially saying "remove all leading characters 
> until you find a character that's not in this sequence" -- 
> a space counts as a character.  (Took me trying it out before I saw this, 
> so don't feel bad. ;) )
> Jeff Shannon
> Technician/Programmer
> Credit International
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor

More information about the Tutor mailing list