Generally get and set methods are for the user to access.
However, I have an attribute I need to update in my class within a public method. This update is one with a private method in the same class.
I'm more curious on the naming convention protocol for this.
Namely, should a private set method look like this?
def _set_player_turn(self):
pass
Or is the idea of a private set method an oxymoron?
It's not an oxymoron. Just because your class does not expose a way to set an attribute doesn't mean it cannot provide a "private" method for its own, internal use.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.