New submission from David Elmakias <marko9...@gmail.com>:

It might be my lack of knowledge in python, however I find this behavior a bit 
strange.

By declaring a private variable in a class, python creates an attribute with 
the name '_<ClassName>__<PrivateVariableName>'.
Both are located on a different location in memory.

I found that by assigning data to the created variable with the exact 
name/notation '_<ClassName>__<PrivateVariableName>' I changed the private 
variable data.

----------
components: Build
files: access_class_private_variable.py
messages: 388862
nosy: AluminumPirate
priority: normal
severity: normal
status: open
title: access python private variable
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file49878/access_class_private_variable.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43519>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to