Anonymus functions revisited

bruno modulix onurb at xiludom.gro
Wed Mar 23 04:57:35 EST 2005


Ron wrote:
> On Tue, 22 Mar 2005 21:45:42 +0100, Bruno Desthuilliers
> <bdesth.quelquechose at free.quelquepart.fr> wrote:
> 
> 
>>Ron a écrit :
>>
>>>On 21 Mar 2005 22:37:42 -0800, "Kay Schluehr" <kay.schluehr at gmx.net>
>>>wrote:
>>>
>>>
>>>
>>>>Mappings like that:
>>>>
>>>> ((x,y),z)   -> x+y-z
>>>>
>>>> ((x,y=0),z) -> None
>>>>
>>>>should be valid actions too.
>>>>
>>>>What is the audience thinking about that?
>>>
>>>
>>>I think that there's too much implied,  and that in the long run it,
>>>if we keep addding in special shortcuts, it will lead to very dificult
>>>to read code.  
>>>
>>
>>Don't like Perl ?-)
> 
> 
> I tried it..  Wrote a html reformatter in it a long time ago. Wasn't
> tempted to do anything else with it. It was good for that, but I went
> a month later and had trouble figuring out how it worked. :)

This was kind of rethorical question !-)

> 
>>The problem here is that Kay's proposition mixes two points: flexible 
>>tuple unpacking and a new syntax for anonymous functions.
> 
> 
> Yes, two different problems. I don't think anything needs to be done
> to tuples myself.  I tend to use lists more anyway.

They are two different beasts. Note that you don't have anything like 
list unpacking, now tuple unpacking is pretty common in Python (swap, 
multiple return values, formatted strings and outputs, ...).

> 
> As far as anonymous functions go... 

>(snip prospective code)
> 
> Yes,  there are probably loads of stuff wrong with this.  ;-)

Err... Isn't it a bit more complicated than our actual lambdas ?-)

-- 
bruno desthuilliers
ruby -e "print 'onurb at xiludom.gro'.split('@').collect{|p| 
p.split('.').collect{|w| w.reverse}.join('.')}.join('@')"



More information about the Python-list mailing list