[Python-ideas] Allowing def to assign to anything
Alexander Walters
tritium-list at sdamon.com
Mon Oct 26 02:23:54 EDT 2015
I imagine in the case of assigning to a class or instance, the name
would be the same (and binding to self would act the same) as if it were
assigned in the traditional way. I do not propose that assigning to
classes in this way be considered a good idea.
as for when assigned to a data structure, my admittedly naive idea would
be to set the name to '__none__' or some such. I am open to other ideas
though.
On 10/26/2015 02:19, Andrew Barnert wrote:
> Seems interesting.
>
> What's the name of the defined function? For an attribution like "spam.eggs" you'd probably want it to be "eggs", and I guess for "spam['eggs']" as well, but what about "spam['two words']" or "spam[2]"?
>
> I assume the qualname is just the name.
>
> Also, would this go through the descriptor mechanism if you def an attribution?
More information about the Python-ideas
mailing list