in-place string reversal
Sybren Stuvel
sybrenUSE at YOURthirdtower.com.imagination
Tue Mar 28 09:17:50 EST 2006
Sathyaish enlightened us with:
> How would you reverse a string "in place" in python?
You wouldn't, since strings are immutable.
> Forget it! I got the answer to my own question. Strings are
> immutable, *even* in python.
Indeed :)
> Why not! The python compiler is written in C, right?
Yup. But what's got that to do with it? Strings are very mutable in C.
> It is amazing how just writing down your problem can give you a
> solution.
:)
Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself?
Frank Zappa
More information about the Python-list
mailing list