[Zope3-dev] interface conventions: default=_RAISE_ERROR

Barry A. Warsaw barry@zope.com
Wed, 15 May 2002 01:41:43 -0400


>>>>> "GP" == Gary Poster <garyposter@earthlink.net> writes:

    GP> Unless I misunderstand, an example of a method for which we
    GP> need a convention is this:

    | def getRequestView(wrapped_object, name, request, 
    | default=ComponentLookupError):

The thing that bothers me most about this is that the exception raised
is determined by the argument passed in.  That seems really icky for
some reason. ;)

>>>>> "GvR" == Guido van Rossum <guido@python.org> writes:

    GvR> Well clarified.  One possible (if verbose) naming convention
    GvR> would be

    GvR>   getRequestViewDefault(wrapped_object, name, request,
    GvR> default=None)

    GvR> vs

    GvR>   getRequestView(wrapped_object, name, request)

And getRequestViewDefault() would return default if the view was
missing, never an exception, but getRequestView() would raise an
exception if the view was missing, but always the same exception.
Right?

If so, that seems okay.
-Barry