[Python-Dev] any support for a methodcaller HOF?

Nick Coghlan ncoghlan at gmail.com
Sun Feb 5 08:09:14 CET 2006


Terry Reedy wrote:
> "Nick Coghlan" <ncoghlan at gmail.com> wrote in message 
> news:43E4A10C.7020703 at gmail.com...
>> Hell no. If I want to write a real function, I already have perfectly 
>> good
>> syntax for that in the form of a def statement. I want to *increase* the
>> conceptual (and pedagogical) difference between deferred expressions and 
>> real
>> functions, not reduce it.
> 
> Mathematically, a function is a function.  Expressions and statements are 
> two syntaxes for composing functions to create/define new functions.  A few 
> languages use just one or the other.  Python intentionally uses both.  But 
> I think making an even bigger deal of surface syntax is exactly the wrong 
> movement, especially pedagogically.

I guess I misstated myself slightly - I've previously advocated re-using the 
'def' keyword, so there are obviously parallels I want to emphasize.

I guess my point is that expressions are appropriate sometimes, functions are 
appropriate other times, and it *is* possible to give reasonably simple 
guidelines as to which one is most appropriate when (one consumer->deferred 
expression, multiple consumers->named function).

I see it as similar to the choice of whether to use a generator function or 
generator expression in a given situation.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-Dev mailing list