Timeline for Why aren't there explicit access modifiers in Python:
Current License: CC BY-SA 3.0
9 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 28, 2017 at 17:39 | comment | added | Kevin | @DanielShin: The fact that you disagree with Python's design decisions is irrelevant. OP asked for the rationale behind those decisions, and this answer provides that rationale. | |
| May 10, 2016 at 8:34 | comment | added | Daniel Shin | Cannot diagree more. Access modifiers promote two of probably the best understood concepts to curtail complexity in big software: Encapsulation and Separation of Concerns. Failing to serve neither of the two simply means python is not a good OOP language nor suitable to building big software and there is nothing wrong with that. But justifiying the absence of such features with typical hobbyist arguments like "Why add complexity when it's not needed?" is just wrong. | |
| May 5, 2012 at 18:04 | comment | added | Giorgio | "Why should I make it hard - or even impossible - to access these, if a future programmer (or even a future me) needs them?" Because one of the basic principle of design is the separation between interface (what a piece of code provides) and implementation (how it provides it). Encapsulation serves to reduce the complexity of the code by reducing the dependencies between different parts of the code. So, public and private are used exactly for the purpose of keeping the code simpler by allowing to see only what is needed. | |
| May 5, 2012 at 10:32 | comment | added | svick | There is a good reason why forbid access to private members: because it may break class invariants. If you can't write private members, then you can't be sure your class behaves correctly. | |
| Jul 14, 2011 at 1:56 | comment | added | Vector | @Daniel - I think you've got it right - it's just that I prefer a different sort of development style. | |
| Jul 14, 2011 at 1:55 | vote | accept | Vector | ||
| Jul 11, 2011 at 18:45 | comment | added | Vector | @Frank: "Putting a method in the "private" category is a hint that you should think thrice before using it, and no more" To me, it simply means I don't have to worry about it when I'm not dealing with it. | |
| Jul 11, 2011 at 17:38 | comment | added | Frank Shearar | "Simple is better than complex" and "We're all consenting adults here" are why Smalltalk doesn't have access modifiers. Putting a method in the "private" category is a hint that you should think thrice before using it, and no more. | |
| Jul 11, 2011 at 12:53 | history | answered | Daniel Roseman | CC BY-SA 3.0 |