On Sat, 28 Aug 2010 09:48:47 +0100
Ian <hobso...@gmaiil.com> wrote:
> > 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.

It seems unnecessary to me.  Even if you can't figure it out through
simple inspection, it takes seconds to fire up Python and type "print
'abc'[::-1]" into it to see what that does. Then you have another tool
in your toolbox.

-- 
D'Arcy J.M. Cain <da...@druid.net>         |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to