econchick / new-coder

New Coder tutorials
zlib License
597 stars 392 forks source link

Python does not have private #224

Open meltinglava opened 7 years ago

meltinglava commented 7 years ago

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.

merwok commented 7 years ago

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?

meltinglava commented 7 years ago

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?

merwok commented 7 years ago

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