On Wed, Feb 11, 2015 at 7:06 PM, Terry Reedy <tjre...@udel.edu> wrote: >> I can't see why the parser would understand more easily >> >> def f(x): >> return x**2 >> than >> >> f = x-> >> return x**2 > > > The parser parses both equally well. That is not the issue.
The compiler could at some point recognize that the function is being assigned to a simple name and transform the assignment into a def for purposes of byte code generation. It could also do the same with lambda, although it currently doesn't. The reason I don't like this replacing def isn't because the name is necessarily lost. It's because the lack of the well-defined def statement encourages more complex usages like functions['f'] = x -> x**2 where such implicit transformations won't work. -- https://mail.python.org/mailman/listinfo/python-list