SimplePrograms challenge
Pete Forman
pete.forman at westerngeco.com
Wed Jun 20 05:44:57 EDT 2007
André <andre.roberge at gmail.com> writes:
> Ok, doctest-based version of the Unit test example added; so much
> more Pythonic ;-)
Sorry for being a bit picky but there are a number of things that I'm
unhappy with in that example.
1) It's the second example with 13 lines. Though I suppose that the
pragmatism of pairing the examples overriding an implicit goal of
the page is itself Pythonic.
2) assert is not the simplest example of doctest. The style should be
>>> add_money([0.13, 0.02])
0.15
>>> add_money([100.01, 99.99])
200.0
>>> add_money([0, -13.00, 13.00])
0.0
3) which fails :-( So both the unittest and doctest examples ought to
be redone to emphasize what they are doing without getting bogged
down by issues of floating point representations.
http://wiki.python.org/moin/SimplePrograms
--
Pete Forman -./\.- Disclaimer: This post is originated
WesternGeco -./\.- by myself and does not represent
pete.forman at westerngeco.com -./\.- the opinion of Schlumberger or
http://petef.port5.com -./\.- WesternGeco.
More information about the Python-list
mailing list