depends on how large XML files you work with, of course. I prefer an API that forces me to be a bit more explicit than a plain "print" before dumping 10 megabytes of stuff to the console... I understand, but I think a programmer would be expecting str(root) to
Hello Fredrik, Wednesday, May 10, 2006, 11:58:09 AM, you wrote: print the string representation of the tree, just like he calls str(int), and see "1" instead of "<int object at xxxxx>". That breaks Pythonic behaviour. Large dumping will happen also when printing *any* large text dump to the screen, and just as Python won't "protect" you from such a dumping, I don't see a pointing in doing it. If a programmer does that dumping once, I think he should be smart enough to press Ctrl+C and change his code. Anyway, I don't see that as bad design, just as a taste matter, and I'm happy with either way - and I agree it would probably be bad to break ElementTree compatibility even if we disagree about something. I would have designed it to have both str() and .tostring() support, having the first calling the second. As I said, other Python types use str() to convert from its native types to strings, so I think that should be used also with Elements and ElementTrees instead of the repr() output - when they want that, they should use that function. From the Python documentation: repr( object) Return a string containing a printable representation of an object. (...) str( [object]) Return a string containing a nicely printable representation of an object. (...) -- Best regards, Steve mailto:howe@carcass.dhs.org