# legacy ordering
if key_func is None:
def key_func(node):
return node
Presumably, this was done for the call which appears later in __get_iter:
children.sort(key=key_func, reverse=reverse)'
However, is perfectly okay to pass key=None into list.sort. In fact, None is the default value for sort, and list.sort already replaces key with an identity function in such cases. The following works just fine:
Inside
tree.__print_backend
you'll find:Presumably, this was done for the call which appears later in
__get_iter
:However, is perfectly okay to pass
key=None
intolist.sort
. In fact,None
is the default value forsort
, andlist.sort
already replaceskey
with an identity function in such cases. The following works just fine: