Re: [sage-devel] Opinion on "assert"

2012-09-25 Thread Nicolas M. Thiery
On Tue, Sep 25, 2012 at 03:18:48PM -0700, Volker Braun wrote: >So because its hard to write good error messages we are better off not >even trying? Obviously not :-) But there are a lot of places where there is no error checking whatsoever. So I want to encourage devs to write at least so

Re: [sage-devel] Opinion on "assert"

2012-09-25 Thread Volker Braun
On Tuesday, September 25, 2012 11:16:07 PM UTC+1, Nicolas M. Thiéry wrote: > Precisely: if you do a grep, you can see that most of the error > messages are verbose and don't bring anymore information than a plain > assert. So because its hard to write good error messages we are better off not

Re: [sage-devel] Opinion on "assert"

2012-09-25 Thread Nicolas M. Thiery
On Mon, Sep 24, 2012 at 02:13:30AM -0700, Volker Braun wrote: >On Monday, September 24, 2012 9:55:34 AM UTC+1, Nicolas M. ThiA(c)ry >wrote: > > - It's very concise, readable and to the point. Compare: > assert i > 0 >With: > if i <= 0: >

Re: [sage-devel] Opinion on "assert"

2012-09-24 Thread Julien Puydt
Le 24/09/2012 11:13, Volker Braun a écrit : On Monday, September 24, 2012 9:55:34 AM UTC+1, Nicolas M. Thiéry wrote: - It's very concise, readable and to the point. Compare: assert i > 0 With: if i <= 0: raise ValueError("i should be a positive integer") The problem is that

Re: [sage-devel] Opinion on "assert"

2012-09-24 Thread Volker Braun
On Monday, September 24, 2012 9:55:34 AM UTC+1, Nicolas M. Thiéry wrote: > - It's very concise, readable and to the point. Compare: > assert i > 0 > With: > if i <= 0: > raise ValueError("i should be a positive integer") > The problem is that the error message i

Re: [sage-devel] Opinion on "assert"

2012-09-24 Thread Jeroen Demeyer
On 2012-09-24 10:55, Nicolas M. Thiery wrote: > I see the point of writing nice ValueError error messages for the most > public or non speed-critical functions. But for other functions I > think we should allow for using asserts. I like this compromise. I think the default should be "don't use ass

Re: [sage-devel] Opinion on "assert"

2012-09-24 Thread Nicolas M. Thiery
Hi Jeroen, Thanks for raising this point! On Mon, Sep 24, 2012 at 09:24:37AM +0200, Jeroen Demeyer wrote: > In Sage, I have seen some quite some places where assert/AssertionError > is used for control flow, where an > > if condition: > raise ValueError("...") # or other exception

[sage-devel] Opinion on "assert"

2012-09-24 Thread Jeroen Demeyer
In Sage, I have seen some quite some places where assert/AssertionError is used for control flow, where an if condition: raise ValueError("...") # or other exception would be the right thing to use instead of an assert. I find this bad, because an assert checks something which should alway