[Numpy-discussion] ANN: NumPy 1.2.0

Charles R Harris charlesr.harris@gmail....
Mon Sep 29 13:44:13 CDT 2008


On Mon, Sep 29, 2008 at 12:32 PM, Robert Kern <robert.kern@gmail.com> wrote:

> On Mon, Sep 29, 2008 at 13:22, Charles R Harris
> <charlesr.harris@gmail.com> wrote:
> >
> > On Mon, Sep 29, 2008 at 12:17 PM, Robert Kern <robert.kern@gmail.com>
> wrote:
> >>
> >> On Mon, Sep 29, 2008 at 13:07, Charles R Harris
> >> <charlesr.harris@gmail.com> wrote:
> >> >
> >> > On Mon, Sep 29, 2008 at 11:50 AM, Robert Kern <robert.kern@gmail.com>
> >> > wrote:
> >> >>
> >> >> On Mon, Sep 29, 2008 at 12:40, Charles R Harris
> >> >> <charlesr.harris@gmail.com> wrote:
> >> >> >
> >> >> > On Mon, Sep 29, 2008 at 11:35 AM, Robert Kern <
> robert.kern@gmail.com>
> >> >> > wrote:
> >> >> >>
> >> >> >> On Mon, Sep 29, 2008 at 12:30, Charles R Harris
> >> >> >> <charlesr.harris@gmail.com> wrote:
> >> >> >> >
> >> >> >> > On Mon, Sep 29, 2008 at 11:27 AM, Robert Kern
> >> >> >> > <robert.kern@gmail.com>
> >> >> >> > wrote:
> >> >>
> >> >> >> >> When is -OO ever used for running tests? The assert statement
> is
> >> >> >> >> used
> >> >> >> >> for tests under nose.
> >> >> >> >
> >> >> >> > When it is the default on windows platforms. There was a
> ticket..
> >> >> >>
> >> >> >> I see #893, which talks about when -OO is used explicitly and when
> >> >> >> numpy is part of a py2exe application. This does not refer to any
> >> >> >> default configuration on Windows platforms.
> >> >> >
> >> >> > Let's put it this way, if the tests were consistent with assert
> then
> >> >> > they
> >> >> > couldn't be run with the -OO option. If they *can* be run with the
> >> >> > -OO
> >> >> > option then they had better run correctly.
> >> >>
> >> >> I'm afraid that I don't understand what you are referring to.
> >> >
> >> > Asserts are transparent. If they go away, programs containing asserts
> >> > should
> >> > still run correctly. It's like bounds checking in array references,
> say
> >> > in
> >> > the std::vector class. If compiled with -DNODEBUG, the programs still
> >> > run.
> >> > Programs shouldn't use asserts for non-debugging purposes, they should
> >> > raise
> >> > real exceptions. If you think the numpy tests are essentially
> debugging
> >> > tests, then they should all disappear when run with the -OO option,
> >> > i.e.,
> >> > nose should do nothing. If nose wants to make that change, that is
> fine
> >> > with
> >> > me. But as is, incorrect failures may be reported and that is an
> error.
> >>
> >> What failures?
> >
> > Read the ticket. And if a test incorrectly passes, that is also an error.
> > Wrong is wrong, programming ain't philosophy.
>
> And practicality beats purity. Just don't run the damn tests with -OO.
> Yes, it's an abuse of the assert statement which was intended for
> inline debugging inside production code. Unit tests are not production
> code. They don't have the same constraints or requirements. In
> particular, unit tests written for the nose framework use (and are
> encouraged to use) assert statements. Deal with it.
>

Knowingly writing incorrect public code when it is easy to do it right can't
be justified. If nose has a bug in this regard, nose should be fixed. And I
think the numpy unit tests *are* production code, they give us information
on the behavior of the different platforms and compilers out there. And what
if there are *real* errors that only show up if python is run with the -OO
options?

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080929/3531b63d/attachment-0001.html 


More information about the Numpy-discussion mailing list