[Python-ideas] An easier syntax for writing decorators(&similar things)?

Steven Bethard steven.bethard at gmail.com
Thu Jan 24 17:44:15 CET 2008


On Jan 23, 2008 11:20 PM, Aaron Brady <castironpi at comcast.net> wrote:
> > > > >         def f( callback, *bar, **bkwar ):
> > > > >                 def preg ( callfore, *far, **fkwar ):
> > > > >                         sf= g( callback, callfore, bar, bkwar, far,
> > > > fkwar )
> > > > >                         return sf
> > > > >                 return preg
> > > > >
> > > > > We see how to rewrite this one?
> > > >
> > > > The Python Ideas list is really intended as sort of a testing ground
> > > > for potential PEPs. What is it that you're proposing to add to or
> > > > remove from the language?
> > >
> > > +1 on prepartial in functools.
> >
> > So far, I've only seen this one use case for prepartial - and I'd
> > rather have decorator_withargs itself than prepartial.  Do you have
> > any other use cases for prepartial (from real code somewhere)?
> >
> > Currently, I'm -1 on adding prepartial to functools, and +0.5 on
> > adding something like decorator_withargs.
>
> Are you also -1 on partial's being in functools?

Not that it matters, since it's already there, but no, I wasn't.  In
fact, the presence of partial is a big reason not to need prepartial
-- most existing use cases are already covered by using partial. As
Arnaud pointed out, if you restrict decorator_withargs to keyword
arguments, you don't even need prepartial, you can just use partial
itself.  Thus, I don't see prepartial as really covering many new use
cases.  If you'd like to convince me otherwise, you're going to need
to post some use cases from real code.

STeVe
-- 
I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
tiny blip on the distant coast of sanity.
        --- Bucky Katt, Get Fuzzy



More information about the Python-ideas mailing list