Yeah, in most places we just use python as you described. In a few localized places it turned out to be useful for detecting issues and working with external resources that were exposed through python objects.

I would not say if this proposal were included with typing that it should be taught as common practice. There are certainly other ways to do this as well, but sometimes it would be convenient.

On Thu, Nov 26, 2020, 1:08 PM Antoine Pitrou <solipsis@pitrou.net> wrote:

Why are you trying to replicate move semantics in Python?  The Python
ownership model is entirely different from C++.  In C++ terms, every
Python object is like a shared_ptr<> (but with additional support for
tracking and collecting reference cycles).

Generally, when a Python function wants to "take ownership" of a
mutable object (say, to mutate it without the caller being surprised),
it makes a copy of the object (e.g. dict.copy()).

Regards

Antoine.


On Thu, 26 Nov 2020 17:34:52 -0000
"William Pickard" <lollol222gg@gmail.com>
wrote:
> C++ has official move syntax via the R-Value Reference (&&).
> C#/.NET is the only other language I know of where it can be emulated (via Constructors/Assignment operators).
>
> I'm not fluent in Perl and Ruby to try to guess if they can support it or not.
> _______________________________________________
> Python-ideas mailing list -- python-ideas@python.org
> To unsubscribe send an email to python-ideas-leave@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/BATDZV2B3LNC6FO3RTUPNTKTB6DRP6BP/
> Code of Conduct: http://python.org/psf/codeofconduct/
>


_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@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/7GHJS3L6T6EC75DTS7CKKO3S7U7YH4VZ/
Code of Conduct: http://python.org/psf/codeofconduct/