On 2016-06-01 06:29, Sven R. Kunze wrote:
Another possibility would be (requiring no syntax change):
name = function(args)
would always be expanded to
name = function(args) name.__name__ = "name"
I'm really against approaches like this that involve explicitly setting a special dunder attribute. What I want from this syntax is for the RHS expression to be able to use the string value of the variable name in whatever way it wants to; restricting it to setting a hard-coded dunder name is not solving the problem. What if, for instance, `function` is a factory function that defines a class at runtime, and that class has its own __name__, but the class (or `function`) wants to use the variable name for something else?