Passing around an ElementTree
Posted
by PulpFiction
on Stack Overflow
See other posts from Stack Overflow
or by PulpFiction
Published on 2010-06-11T12:37:53Z
Indexed on
2010/06/11
12:43 UTC
Read the original article
Hit count: 159
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?
© Stack Overflow or respective owner