On 2/11/2015 8:04 AM, Albert van der Horst wrote:
It is not until we assign the object to a name (which becomes thereby a function) that the __name__ thingy comes into play, like so.
But __name__ would not come into play.
f = x->x**2
This would mean to create an anonymous function object and then bind 'f' to that object in the current local namespace. It would be the same as the discouraged
f = lambda x: x**2
I've heard arguments that with -> the __name__ is not filled in correctly.
Because local namespace name binding does not and should not mutate the object the name is bound to.
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. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list