enhancementgood first issue
仓库指标
- Star
- (203 star)
- PR 合并指标
- (PR 指标待抓取)
描述
I don't know if this would break something but wouldn't be better to have every element default to have an attribute _pfp__children equal to an empty list?
This way when write something like obj._pfp__children in say, traversing the DOM's graph (DFS or alike) you don't have to worry about exceptions and the code is more succinct.
Right now I am using an auxiliary function like:
def has_children(n):
""" Returns boolean """
try:
n._pfp__children
return True
except AttributeError:
return False
but it looks cumbersome and feels more natural to return an empty list to the question "give me a list containing your children"
Anyway, awesome work man :+1: