how do "real" python programmers work?

Carl Friedrich Bolz cfbolz at gmx.de
Fri Jan 13 08:17:23 EST 2006


Scott David Daniels wrote:
> bblais wrote:
> 
>>How do experienced python programmers usually do it?  Is there a
>>"usually" about it, or is it up to personal taste?  Are there any
>>convenient ways of doing these things?
> 
> There are a lot of us who use a test-first process:
>     Write a unit test, watch it fail, fix the code til the test passes.

I second that. This is pretty much how I work (and almost all the other 
people in the PyPy project seem to have a similar strategy). First write 
a minimal test (with the py.test framework in the PyPy case). Then run 
it to see it fail which is important because it is easy to write a test 
that does not really test anything. Then do the least possible amount of 
work to make the test pass. I use konsole with one tab with vim and 
another tab where I run py.test, but that is a matter of taste. If the 
test fails although I think it should work I use the py.test 
pdb-feature, which lets you start pdb within the context of the failing 
test. When the test finally passes, I check it and the new code in. 
Rinse and repeat.

Cheers,

Carl Friedrich




More information about the Python-list mailing list