[Zope3-dev] interface conventions: default=_RAISE_ERROR

Jim Fulton jim@zope.com
Wed, 15 May 2002 14:13:50 -0400


Steve Alexander wrote:
> 
> Guido van Rossum wrote:
> >
> > Well clarified.  One possible (if verbose) naming convention would be
> >
> >   getRequestViewDefault(wrapped_object, name, request, default=None)
> >
> > vs
> >
> >   getRequestView(wrapped_object, name, request)

I think we're on the right track looking for method pairs.

> That makes for interesting method names in the View Service of the
> Component Architecture. So, these:
> 
>   def getDefaultViewName(self, object, type, default=_marker):
>   def getRequestDefaultViewName(self, object, request, default=_marker):
> 
> Might become these:
> 
>   def getDefaultViewName(self, object, type):
>   def getDefaultViewNameDefault(self, object, type, default=None):
> 
>   def getRequestDefaultViewName(self, object, request):
>   def getRequestDefaultViewNameDefault(self, object, request,
>                                        default=None):
> 
> While they do make sense, they look very silly.

I agree.

Maybe the default and no-default cases should be distinguished by
the starting verb.  I think getXXX should be like dictionary get, 
except that we should require a default value argument.

I'm not sure verb to use for the no default case.

Anybody got any ideas?

Maybe the no default case should ommit the verb, as in:

  getRequestDefaultViewName(object, request, default=None)

  requestDefaultViewName(object, request)

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