In my program, I need to make use of an ElementTree object in various functions in my program.
More specifically, I am doing this:
tree = etree.parse('somefile.xml')
I am passing this tree around in my program.
I was wondering whether this is a good approach, or can I do this:
- Create a global tree (I come from a
C++ background and I know global is
bad)
- Create the tree again wherever required.
Or is my approach ok?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…