On 27/08/2010 21:51, Jussi Piitulainen wrote:
Meanwhile, I have decided to prefer this:

def palindromep(s):
     def reversed(s):
         return s[::-1]
     return s == reversed(s)
I like this.

s[::-1] is obscure and non-obvious, especially to Python noobs.

This makes it clear what is going on and why at a cost of very little code.

Very helpful to the maintenance programming in 18 months time!

Regards

Ian
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to