Would Anonymous Functions Help in Learning Programming/Python?

Bruno Desthuilliers bruno.42.desthuilliers at wtf.websiteburo.oops.com
Mon Sep 24 07:16:24 EDT 2007


Matthew Woodcraft a écrit :
> Cristian  <super.sgt.pepper at gmail.com> wrote:
>> To me, the biggest setback for new programmers is the different
>> syntax Python has for creating functions. Instead of the common (and
>> easy to grasp) syntax of foo = bar Python has the def foo(): syntax.
> 
> [...]
> 
>> in a program like Python there doesn't seem to be any other reason to
>> have it.
> 
> One reason for the different syntax is that functions, unlike most
> other objects, know their own names (which can be shown in tracebacks
> and the like).

Nope. They know *one* of their names - the one they've been given when 
first instanciated. Which may or not be the name used to get at them...



More information about the Python-list mailing list