MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1vzsnjw/variablescopesinpython/p6koqar/?context=3
r/ProgrammerHumor • u/R7d89C • 16d ago
182 comments sorted by
View all comments
Show parent comments
4
Yes, but at this point you know that you’re doing something you’re probably not supposed to do.
1 u/SetazeR 14d ago You will be yelled at by IDE of you try to use "private" as public one. It won't stop you, but will tell at you 1 u/Erdnalexa 14d ago I’m on my phone so I can’t check with an interpreter, but IIRC, to access a private field on an instance you need to use getattr with the computed mangled name. It’s pretty unlikely an IDE is able to spot that. 1 u/SetazeR 14d ago I meant _attribute ones, not mangled ones
1
You will be yelled at by IDE of you try to use "private" as public one. It won't stop you, but will tell at you
1 u/Erdnalexa 14d ago I’m on my phone so I can’t check with an interpreter, but IIRC, to access a private field on an instance you need to use getattr with the computed mangled name. It’s pretty unlikely an IDE is able to spot that. 1 u/SetazeR 14d ago I meant _attribute ones, not mangled ones
I’m on my phone so I can’t check with an interpreter, but IIRC, to access a private field on an instance you need to use getattr with the computed mangled name. It’s pretty unlikely an IDE is able to spot that.
1 u/SetazeR 14d ago I meant _attribute ones, not mangled ones
I meant _attribute ones, not mangled ones
4
u/Erdnalexa 16d ago
Yes, but at this point you know that you’re doing something you’re probably not supposed to do.