doctest, unittest, or if __name__='__main__'
Christoph Zwerschke
cito at online.de
Tue Mar 28 17:27:43 EST 2006
lollipopenator at gmail.com wrote:
> Hi there Christopher, I was wondering if you (or anyone reading this )
> could quickly summarize the ways in which unittest is unpythonic, or
> point me to somewhere which discusses this.
> Is this 'consensus opinion' or mainly your own opinion?
It is just a consequence from the fact that unittest is actually a port
from JUnit (Java) to Python, i.e. a consequence of trying to emulate a
standard framework that many programmers are already familiar with,
which is essentially not a bad idea. However, if you try to counterfeit
Java programming, your code won't be effective or elegant in Python.
> Is there a summary somewhere (in addition to the Zen of Python thingy)
> of what kinds of things are 'pythonic' and why they are considered so?
> I see it referred to a lot, and am starting to get a feel for it in
> some areas but not others.
It's probably never been listed completely (and it also changes slowly
as the language evolves). Programming in an unpythonic way is like
driving a nail with a screwdriver. Here are some more explanations:
http://faassen.n--tree.net/blog/view/weblog/2005/08/06/0
http://mail.python.org/pipermail/europython/2005-April/004975.html
-- Christoph
More information about the Python-list
mailing list