This reminds me of something in C++. Does it exist in other languages? Do you have a more realistic example where this would catch an important type error?
On Thu, Nov 26, 2020 at 5:42 AM <3mi...@gmail.com> wrote: > Add something like Move type hint to typing module. It will tell the > analyzer that the input parameter of the function is moved and can not be > used after. For example: > ``` > def f(d: Move[dict]) -> dict: > d['a'] = 2 > return d > > d = {1: 2} > f(d) > print(d[1]) # mistake, using of moved value > _______________________________________________ > 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/WJXFEVKR3IU7BAI57DFUUZZYS6UA3P6N/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>
_______________________________________________ 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/DA2BKL6LDHQ5ZKBYZJVJ7DAHA47U7TVA/ Code of Conduct: http://python.org/psf/codeofconduct/