6 ms·
The Python developers' position is that protected/private modifiers are really just convention too. Someone who wants to access a private member in Java can use
by pseudalopex 9y ago
The Python developers' position is that protected/private modifiers are really just convention too. Someone who wants to access a private member in Java can use reflection. We can't stop them, so why pretend?
- wvenable 9y agoBy definition protected/private modifiers aren't convention as they're part of the language itself. Convention is something that doesn't exist in the language. You cannot mark properties as private or protected in Python so the convention is that underscore means private or protected. There are no getters or setters in Java so the convention is to use a method with a get/set prefix. I would argue that such a common programming practice (enforced or not) should not be left to convention.