[Python-Dev] Warning Framework (PEP 230)

Thomas Wouters thomas@xs4all.net
Mon, 11 Dec 2000 19:04:56 +0100


On Mon, Dec 11, 2000 at 12:11:02PM -0500, Guido van Rossum wrote:

> > How about returning 1 for 'warning turned into exception' and -1 for 'normal
> > exception' ? It would be slightly more similar to other functions if '-1'
> > meant 'exception', and it would be easy to put in an if statement -- and
> > still allow C code to ignore the produced error, if it wanted to.

> Why would you want this?  The user clearly said that they wanted the
> exception!

The difference is that in one case, the user will see the original
warning-turned-exception, and in the other she won't -- the warning will be
lost. At best she'll see (by looking at the traceback) the code intended to
give a warning (that might or might not have been turned into an exception)
and failed. The warning code might decide to do something aditional to
notify the user of the thing it intended to warn about, which ended up as a
'real' exception because of something else.

It's no biggy, obviously, except that if you change your mind it will be
hard to add it without breaking code. Even if you explicitly state the
return value should be tested for boolean value, not greater-than-zero
value.

-- 
Thomas Wouters <thomas@xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!