why ; ?

bearophile bearophileHUGS at lycos.com
Fri May 9 13:33:23 PDT 2008


This answer is mostly off topic in this newsgroup...

Nick Sabalausky:
> > epsilon=0
> > S=0
> > while epsilon<10:
> >   S=S+epsilon
> >   epselon=epsilon+1
> > print S
> >
> > It will print zero, and it is not easy to find such a bug!

No language is perfect, it's always a compromise. For my personal style of programming Python is closer to being the best (I use D a lot because I need to be "closer to the metal", and I like it a lot). I think I have done a similar mistake only twice in more than 60 thousand of lines of Python I have written, and I have found the bug once 30 seconds later, and the other time ten minutes later, using doctests:
http://docs.python.org/lib/module-doctest.html
they are a very good tool to test your code and spot bugs. Dynamic languages allows you to spot and fix those bugs faster, so it's a matter of balance. Usually the worse bugs aren't misspelled variable names.

Bye,
bearophile



More information about the Digitalmars-d mailing list