We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2962e24 commit 3deeabeCopy full SHA for 3deeabe
tests/cpydiff/core_class_name_mangling.py
@@ -0,0 +1,26 @@
1
+"""
2
+categories: Core,Classes
3
+description: Private Class Members name mangling is not implemented
4
+cause: The MicroPython compiler does not implement name mangling for private class members.
5
+workaround: Avoid using or having a collision with global names, by adding a unique prefix to the private class member name manually.
6
7
+
8
9
+def __print_string(string):
10
+ print(string)
11
12
13
+class Foo:
14
+ def __init__(self, string):
15
+ self.string = string
16
17
+ def do_print(self):
18
+ __print_string(self.string)
19
20
21
+example_string = "Example String to print."
22
23
+class_item = Foo(example_string)
24
+print(class_item.string)
25
26
+class_item.do_print()
0 commit comments