Now that Python has type annotations has there been any thought into having 
access protection annotations.  This would be for same reason as type 
annotations: to give the linter the opportunity to catch bugs early, and to 
give the programmer a uniform way to specify invariants.

Unlike type annotations, this wouldn't need any new syntax, but it should 
be well thought-out.  My rough idea is to have some decorator on methods 
and properties describing who is allowed to call those methods and access 
those properties.  The allowed caller list could be things base classes.

I think this would need to be better thought-out, but something like this 
would be really useful for me as it's hard to keep track of who is allowed 
to call what.

Best,

Neil
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to