invert or reverse a string... warning this is a rant

rick ath-admin at vt.edu
Fri Oct 20 08:17:48 EDT 2006


Fredrik Lundh wrote:
> "Brad" <rtilley at vt.edu> wrote:
> 
>> Do you have children? How would your child feel if he brought you
>> something he had made and you then told him it was awful in *sooo* many
>> ways.
> 
> If you're arguing that everything a child does and says should be rewarded...


I'm not arguing that. Only that one should be polite and considerate 
when giving advice. That's all.

foo[::-1] is acceptable. So is the helper function that you posted:

>     def reverse(s):
>         return s[::-1]

My 2 min hack is awful to some, and I'm OK with that and fully expect 
it. But it works OK for me. Is there not room for solutions such as this 
in Python?

No hard feelings. Let's close this thread. I'll accept the slicing and 
memorize it.

Thanks guys.



More information about the Python-list mailing list