On Thu, Nov 26, 2020 at 1:51 PM Bruce Leban <br...@leban.us> wrote:

> What might be useful are declarations that:
>
>    - The object is not modified (i.e., read only). If a function that
>    declares a parameter as read-only passes that parameter to one that does
>    not use that declaration, that can be identified as an error.
>    - The object is destroyed or consumed by the function. Any use of the
>    object after calling the function could be identified as an error.
>
>
I don't think Python is ready for const arguments (the first bullet).
"Const propagation" can be a real problem.

The second seems to be what the OP is after, and I now can see the use case
-- in fact in libraries for scientific computing and/or machine learning I
think Iv'e seen are a bunch of hacks to imply transfer of ownership that
might benefit from this. But I'm not yet sufficiently familiar with that
field to be able to point you to examples. Hopefully there are readers here
who can. (Nate?)

-- 
--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/VPD2Q55LOBZH46XC7UA4I3QMN773JZCZ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to