Is there a general convention about exposing members in Python classes? I know that this is a case of "it depends", but maybe there is a rule of thumb.
Private member:
class Node:
def __init__(self):
self.__children = []
def add_children(self, *args):
self.__children += args
node = Node()
node.add_children("one", "two")
Public member:
class Node2:
def __init__(self):
self.children = []
node2 = Node2()
node2.children += "one", "two"
If there is no good reason to make children
private, would you stay with the method add_children
?