3 ms·
Python would like a word...
by actusual 4y ago
Python would like a word...
- jstx1 4y agoWhile we're on Python and private methods - what's with everyone just _underscoring every method and variable by default? Does anyone teach people to do this or have I just ran into a few people with this habit by chance? I know what _underscoring does in Python and what PEP8 recommends but doing it all the time for everything is so ugly and unnecessary.
- ajoseps 4y agoI think it's because of what underscoring does. It's the "fake" privacy in Python. Also autocompleters tend to ignore those functions
- swinglock 4y agoPerhaps you worked with Java/C++ programmers using Python.
- frenchy 4y agoProbably for the same reason that zero-based versioning (https://0ver.org/ https://0ver.org/) is so popular. People want to avoid commitment.
- mytailorisrich 4y agoThe language is not relevant to the question. Making variables and methods private means making them inaccessible outside the class and I gave the typical reasons/best practices for that.
- Saphyel 4y ago> Making variables and methods private means making them inaccessible outside the class and I gave the typical reasons/best practices for that. The point they are making is in python there's no private method, everything is public. There's only a convention of "avoid using anything starting with "_"
- mytailorisrich 4y agoYes but that point is irrelevant to the question...