Closed ioxu closed 11 months ago
Fix handling of leave argument in .update_structure().
leave
.update_structure()
https://stackoverflow.com/questions/1132941/least-astonishment-and-the-mutable-default-argument
Change leaves : list = list() to leaves : list = None and in body use
leaves : list = list()
leaves : list = None
if leaves is None: leaves = []
The linter warned me with this:
Dangerous default value list() (builtins.list) as argumentPylintW0102:dangerous-default-value
and now I now what that means.
It caught me in .remove_children()
.remove_children()
def remove_children(self, old_children = []) -> list:
became
def remove_children(self, old_children = None) -> list:
Fix handling of
leave
argument in.update_structure()
.https://stackoverflow.com/questions/1132941/least-astonishment-and-the-mutable-default-argument
Change
leaves : list = list()
toleaves : list = None
and in body useThe linter warned me with this:
and now I now what that means.
It caught me in
.remove_children()
became