On Thu, May 6, 2021 at 10:49 PM Shreyan Avigyan
<[email protected]> wrote:
> The benefit of private is actually debugging. If somehow, someone finds that 
> the private member has changed they would immediately know that it was a 
> memory leak or the value was changed through a set method defined in the 
> class (This is one of most important pillar of access modifiers in OOP). 
> Python's private convention most of the time helps but since it doesn't 
> enforce it someone just might introduce a bug in an application by modifying 
> a private member. I just gave an example of security it was not the main 
> point.
>

If someone changes a private member of another class and introduces a
bug, isn't that on them? The whole point of a single leading
underscore is to declare that this isn't part of the public API
(namedtuples aside), so you're on your own if you read it - doubly so
if you change it.

But if someone changes a private member of another class and *fixes* a
bug, surely that's a good thing?

ChrisA
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/P4ZKMFGJFWSIXSVNTCOQAGZU4HGU56IK/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to