palindrome iteration

Josh English joshua.r.english at gmail.com
Sun Aug 29 16:38:22 EDT 2010


I have no idea. That's a lower level of programming than I'm used to
dealing with.

Josh

(I also only tried the one value. Had I tried with other strings that
would fail the test, some
functions may have performed better.)

On Aug 29, 2:19 am, Matteo Landi <landima... at gmail.com> wrote:
> Well, I tried the also the solution posted above (recursive w/o
> slicing and iterative), and I discovered they were the slowest..
>
> is_palindrome_recursive 2.68151649808
> is_palindrome_slice 0.44510699381
> is_palindrome_list 1.93861944217
> is_palindrome_reversed 3.28969831976
> is_palindrome_recursive_no_slicing 6.78929775328
> is_palindrome_iterative 4.88826141315
>
> Nothing to say about the iterative function, but the benchmark of the
> recursive was unexpected, at least for my point of view: do you think
> it is due to the try/except overhead?
>



More information about the Python-list mailing list