Zope 3.0, and why I won't use it

Alex Martelli aleaxit at yahoo.com
Tue Nov 16 07:54:10 CET 2004

Josiah Carlson <jcarlson at uci.edu> wrote:

> def d_adapt(t):
>     def f(a):
>         return adapt(a, t)
>     return f
> def d_adaptors(*adaptors):
>     #some work necessary to make kwargs work
>     def f(fcn):
>         def f(*args):
>             return fcn(*[i(j) for i,j in zip(adaptors, args)])
>         return f
>     return f
> @d_adaptors(d_adapt(foo), d_adapt(bar))
> def x(y, z):
>     <body of x>

Can do with less work:

def d_adap(*types):
    def f(fcn):
        def f(*args):
            return fcn(*(adapt(i, j)
                         for i, j in izip(types, args)))
        f.__name__ = fcn.__name__
        return f
    return f

@ d_adap(foo, bar)
def x(y, z):
    <body of x>

but the point is whether, if and when 'optional static typing' _syntax_
gets it, it will have this semantics or that of inserting a lot of
typechecks... people can do typecheks or adaptation now, and neither
will go away -- but which, if either, should syntax facilitate?  That,
as I see it, is key.


More information about the Python-list mailing list