2 ms·
I agree with this. The code is not just a message to the compiler to build the binary/bytecode, it is also a message to other programmers. As such there is valu
by rdtsc 12y ago
I agree with this. The code is not just a message to the compiler to build the binary/bytecode, it is also a message to other programmers. As such there is value in annotating things in that manner.
Even in Python, a very dynamic language, there is a convention that methods that start with _ are private. And I often also separate them into a different (bottom) section with a big header saying this is the private block of methods. So in that case there isn't a compiler rule but rather a common convention (which is kind of a step above comments if you wish).
- rpedroso 12y agoIf you want to enforce this more stringently, you can even prefix methods with __ (double underscore). Python will mangle the name: __mydef -> _myClass__mydef You can, of course, still access the method, but it's very useful for keeping implementation details of a base class out of a subclass. This way, your subclass can have its own `mydef` without overriding the base class.