[ZODB-Dev] Raw serial string in exception message
Jim Fulton
jim@zope.com
Mon, 21 Jan 2002 10:43:20 -0500
Steve Alexander wrote:
>
> Greg Ward wrote:
> >
> > Oh good, I'm not the only one who's bothered by that. AFAICT, the only
> > reason to raise the exception that way is that it's consistent with how
> > Python raises KeyError:
> >
> > >>> d = {}
> > >>> d['foo']
> > Traceback (most recent call last):
> > File "<stdin>", line 1, in ?
> > KeyError: foo
>
> This example illustrates the difference better:
>
> >>> {}['foo\012bar']
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> KeyError: foo
> bar
>
> The example above shows that Python doesn't call repr on keys when
> raising a KeyError. Perhaps it should. I guess unprintable keys are less
> common in non-ZODB python apps.
>
> > But I think that's pretty thin. +1 on changing serial to repr(serial)
> > there.
>
> +1 from me.
+1 from me too, except that I'd prefer that this happen in the code
that stringifies exceptions. OTOH, repring in the raise is OK with
me too.
Jim
--
Jim Fulton mailto:jim@zope.com Python Powered!
CTO (888) 344-4332 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org