Thank  you  for the clear explanation.

Robert


On Wed, 2009-09-23 at 23:40 +0000, ALAN GAULD wrote:
> > Is there a significant difference in speed, style, or any pythonesque
> > reasoning between Alan's solution and 
> > print message[::-1]
> 
> 
> Yes, the for loop doing one character at a time will be much 
> slower than using a slice. The slice is more pythonic but less general.
> A reverse loop is something that is often needed in programming 
> solutions so it's useful to know how to do it for the general case. 
> But where the data  can be sliced that will be faster and more 
> concise.
> 
> Alan G.

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to