2016-06-02 14:45 GMT+02:00 Steven D'Aprano email@example.com:
But if you want to extend it to solve "far more" (whatever you mean by that), please don't hijack this thread. If you think of some other problems you would like to solve (whatever they might be), please feel free to propose a solution to them in another thread. But *this* discussion is about solving *this problem*:
Some (but not all) functions need to know the name of their assignment target, so that the object they return can give itself a name that matches that target. Or to put it another way, some objects need to know their own name. The existing solution to that is simple, but inelegant and annoying: you have to manually type the name as a string and pass it as an argument to the function.
If you want to solve some other problem, please do! But that's not part of this thread, and if the proposed solution to *this* problem doesn't solve *your* problem, that's irrelevant.
I want to extend it to: some object also need to know module they're declared and their own qualified name (for example for pickling support).