• 🇨🇦 tunetardis ( tunetardis@piefed.ca ) 
    link
    fedilink
    English
    arrow-up
    1
    ·
    4 months ago

    Coming from C++, I initially thought it aggravating that you have to go self. everywhere when working with classes in Python. But I’ve conceded that it improves code-legibility, and now I’m going this-> everywhere when I’m back in C++.

      • 🇨🇦 tunetardis ( tunetardis@piefed.ca ) 
        link
        fedilink
        English
        arrow-up
        1
        ·
        4 months ago

        My personal convention in C++ was to use an m prefix on member variables and a g for class variables.

        I guess in Python, I think of _ as equivalent to protected scope in C++ and __ (double underscore) as equivalent to private. Not a perfect analogy, but it works for me.