Passing around an ElementTree
- by PulpFiction
Hello.
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?