[Python-ideas] Quick idea: defining variables from functions that take the variable name
Piotr Duda
duda.piotr at gmail.com
Thu Jun 2 08:55:25 EDT 2016
2016-06-02 14:45 GMT+02:00 Steven D'Aprano <steve at pearwood.info>:
> 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).
--
闇に隠れた黒い力
弱い心を操る
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160602/4f928cec/attachment.html>
More information about the Python-ideas
mailing list