Why is python slower compared to Ruby even with this very simple “test”?
问题 See Is there something wrong with this python code, why does it run so slow compared to ruby? for my previous attempt at understanding the differences between python and ruby. As pointed out by igouy the reasoning I came up with for python being slower could be something else than due to recursive function calls (stack involved). I made this #!/usr/bin/python2.7 i = 0 a = 0 while i < 6553500: i += 1 if i != 6553500: a = i else: print "o" print a In ruby it is #!/usr/bin/ruby i = 0 a = 0 while