On Wed, 29 Sep 2010 06:03:21 am Corey Richardson wrote:
>   Hello tutors.
>
> I hate doing this:
>              string = string.lower()
>
> Is there a way to do it without the "string =" part? Thanks.

No, strings are immutable. Once they're created, they cannot be changed.

This is no different from:

x = 42
x = x/2  # or x /= 2 if you prefer

instead of:

x = 42
x/2


As an alternative you could look at the UserString module, and the 
MutableString class it includes, but MutableString has some serious 
limitations and is not really meant for serious work. But it might do 
the job you want.



-- 
Steven D'Aprano
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to