new-coder icon indicating copy to clipboard operation
new-coder copied to clipboard

Python does not have private

Open meltinglava opened this issue 8 years ago • 3 comments

http://newcoder.io/gui/part-2/ says " We can do this by creating a private function " . But it is not actually private. It just says that if you refer to that function, you will get your version of that function, and not the subclassers verson, if he also have made a function with the same name.

meltinglava avatar Sep 15 '17 07:09 meltinglava

Yes, that’s what private means in Python. It’s important to learn how Python deliberately lets you reach into internals and prefers «consenting adults» over over-rigid enforcement, but I don’t know if this tutorial is the right place for that. What do you think? Were you misled or confused by the text?

merwok avatar Sep 15 '17 15:09 merwok

I think that we should not use the word private, as it's meaning is so vastly differente from other programming languages. And does it actually matter here. Are we ever suspecting that this is ever going to get subclassed?

meltinglava avatar Sep 19 '17 21:09 meltinglava

I would approve a change from «private method» to «internal method» and replacing the double dash with just one.

merwok avatar Sep 20 '17 15:09 merwok