I'd be in favor of a nice syntax for named mapping unpacking. But while we are at discussion - I'd point out it is "possible" (not easy) with current day syntax, by abusing the command "import" - One can set appropriate import hooks that would enable either for the current module, or maybe, in a context ("with") block the use of import targeting a variable - so, the syntax
from mymap import key1, key2 can work. Downside: it will be much slower than an assignment. I have something similar working, but it is currently based on monkey patching builtins.__import__ - upgrading it to properly using the import machinery is on the roadmap. On Fri, Feb 11, 2022 at 8:25 AM Matsuoka Takuo <motogeom...@gmail.com> wrote: > On Fri, 11 Feb 2022 at 04:02, Christopher Barker <python...@gmail.com> > wrote: > > > > Just one note: > > > > On Thu, Feb 10, 2022 at 6:56 AM Chris Angelico <ros...@gmail.com> wrote: > >> > >> > (2) For the form of the assignment target, I think an analogy with the > >> > reception of function arguments could also be considered. > > > > > > I think so -- maybe only because it's new, but folks are certainly far > more familiar with **kwargs than pattern matching. > > Structural pattern matching does a more general assignment than > happens at passing of function arguments. So the latter is simpler, > but is sufficient (at least conceptually) for the form of assignment > considered here. However, both of them may lead to distinct pieces of > syntax, both of which might possibly be useful. > > Best regards, > Takuo Matsuoka > _______________________________________________ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/N6MXW3HNFJBBUY3BCJBQTGA6WGEQGDMI/ > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/UC57YSWO7KLAXADXE5UCL3ILP4W7ZNMO/ Code of Conduct: http://python.org/psf/codeofconduct/