[Zope3-dev] interface conventions: default=_RAISE_ERROR
Gary Poster
garyposter@earthlink.net
Fri, 10 May 2002 20:24:14 -0400
On Friday 10 May 2002 08:26 pm, Guido van Rossum wrote:
> > > in the __init__ of the Interfaces package. An interface that wants to
> > > use the default marker would simply
> > > from Interface import Interface, _RAISE_ERROR
> > > and implementations could import from their interfaces or from the
> > > original declaration in the Interface package.
> >
> > I really wouldn't bother. It saves very little typing, adds to the
> > complexity of finding out what things really mean, adds another
> > dependency, and saves a few hundred bytes at most per runtime.
>
> While we're at it, I don't particularly like the pattern. If it is
> used I think there should be a *public* value so that a caller can be
> explicit about "I want the exception" rather than having to use a
> short argument list.
>
> Where this is used, would it be acceptable if the exception itself
> (KeyError?) was specified as the default value? Or is an exception a
> valid regular default?
>
> --Guido van Rossum (home page: http://www.python.org/~guido/)
Yup, better solution. As far as I'm concerned, at least. Can I start using
this, folks?
Gary