On Sun, Feb 8, 2015 at 6:55 PM, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote: > If this were syntax, then the compiler could just as easily set the function > name from -> as from def. Lambda has the limitations that it has because it > is an expression, not because of magical "def" properties.
True, it could, but it would be odd that what looks like assignment and an expression is actually magical syntax. But it might be nice to have something that functions as lambda currently does, unless it detects that it's being assigned directly to a name, in which case the magic kicks in and it gets a name. square = x->x**2 # Name is "square" operator["square"] = x->x**2 # Maybe? create_operator("square", x->x**2) # Name is "<lambda>" But I suspect that this would create some hairy grammatical quirks. Still, as an "alternate syntax for creating a lambda function", it seems at least plausible. ChrisA -- https://mail.python.org/mailman/listinfo/python-list