@decorator syntax is sugar, but for what exactly?

Dan Sommers me at privacy.net
Mon Aug 9 22:49:26 EDT 2004


On Mon, 09 Aug 2004 17:49:13 -0700,
Jeff Shannon <jeff at ccvcorp.com> wrote:

> Dan Sommers wrote:

>> When I see f( x ), I think that f is a function bound by def (or an
>> extremely close relative, such as class or staticmethod), and that I can
>> grep for it somewhere, either in the source code or the library
>> reference.  I also think, rightly or wrongly, that f *was* bound,
>> *before* I needed it, and *does not change over time*.
>> 
>> When I see apply( f, x ), I think that f varies over time, and is some
>> sort of a callback or plugin or whatever, and is *not* the name of an
>> actual function bound by def.  

> Um, I think you're missing the point, here.  The apply() has nothing to
> do with whether func() is bound by def or by assignment -- both cases
> given here are intended to allow the easy passing of variable argument
> lists to functions.

I think you're right:  I have at least two issues all wound up together
here.  My background is such that if you need different argument lists,
then you need different functions.  It's amazing how flexible something
as outwardly simple as apply can be.

I will reduce my original notion to f( x ) screams "this is pretty much
the same all the time," but apply indicates something more interesting.

Thanks for being so patient with this old timer.  :-)

Dan

-- 
Dan Sommers
<http://www.tombstonezero.net/dan/>
Never play leapfrog with a unicorn.



More information about the Python-list mailing list