Adding optional 'explicit' declaration?
Mark 'Kamikaze' Hughes
kamikaze at kuoi.asui.uidaho.edu
Thu Apr 26 16:47:45 EDT 2001
26 Apr 2001 12:45:00 GMT in <slrn9eg5uc.34r.scarblac at pino.selwerd.nl>,
Remco Gerlich <scarblac at pino.selwerd.nl> spake:
> Laurent Pointal <pointal at lure.u-psud.fr> wrote in comp.lang.python:
>> The transparent creation of variables in Python is really nice, but there
>> are times when it become a bug source, essentially because of misstyping of
>> variable names.
> Does anyone have any numbers on this? People make this claim all the time,
> but in practice my typos are always caught at compile time or immediate
> testing already. I believe bugs like this are really rare.
I agree; it's pretty uncommon to mistype variable names like that. If
you have a good editor with name completion and syntax highlighting, you
get even fewer of them.
But most importantly, if you have *UNIT TESTS*, like with that very
nice PyUnit which is now shipped with Python, then you catch these
during unit testing. If you work test-first, you basically cannot
produce these errors (see _Extreme Programming_ by Kent Beck, and _The
Pragmatic Programmer_ by Andrew Hunt and David Thomas).
Unit tests are generally easy, and they're even fun - after a while
you get a bit of a rush from seeing the green bar so you know your code
works, and a bit of a shock when you see red bar...
There are things that are hard to unit test - GUI's and multithreaded
code are moderately difficult... But if the individual pieces work,
some functional testing can prove them out.
It's the 21st century. Why are people still not unit testing?
--
<a href="http://kuoi.asui.uidaho.edu/~kamikaze/"> Mark Hughes </a>
"I will tell you things that will make you laugh and uncomfortable and really
fucking angry and that no one else is telling you. What I won't do is bullshit
you. I'm here for the same thing you are. The Truth." -Transmetropolitan #39
More information about the Python-list
mailing list