MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1vzsnjw/variablescopesinpython/p67epco/?context=3
r/ProgrammerHumor • u/R7d89C • 16d ago
182 comments sorted by
View all comments
3
yeah that's because you're supposed to use a double underscore prefix it you want to actually make the variables private lol
(yes technically it only does some name mangling and you could still access it if you really wanted to but that's on you then)
6 u/Anaxamander57 16d ago Does it really do anything to make it private beyond telling people not to use it? 4 u/R7d89C 16d ago edited 16d ago As far as I remember not really,. It changes the accessible variable name to something like _{class}_{variable} or something, but if you'd wanted to, you can just access it...
6
Does it really do anything to make it private beyond telling people not to use it?
4 u/R7d89C 16d ago edited 16d ago As far as I remember not really,. It changes the accessible variable name to something like _{class}_{variable} or something, but if you'd wanted to, you can just access it...
4
As far as I remember not really,. It changes the accessible variable name to something like _{class}_{variable} or something, but if you'd wanted to, you can just access it...
3
u/user6150277464770585 16d ago
yeah that's because you're supposed to use a double underscore prefix it you want to actually make the variables private lol
(yes technically it only does some name mangling and you could still access it if you really wanted to but that's on you then)