Carl Banks wrote:
>> Why isn't et.parse the only way to do this? Why have XML or fromstring  
>> at all?
> 
> Because Fredrick Lundh wanted it that way.  Unlike most Python
> libraries ElementTree is under the control of one person, which means
> it was not designed or vetted by the community, which means it would
> tend to have some interface quirks.

Just for the record: Fredrik doesn't actually consider it a design "quirk".
He argues that it's designed for different use cases. While parse() parses
a file, which normally contains a complete document (represented in ET as
an ElementTree object), fromstring() and especially the 'literal wrapper'
XML() are made for parsing strings, which (most?) often only contain XML
fragments. With a fragment, you normally want to continue doing things like
inserting it into another tree, so you need the top-level element in almost
all cases.

Stefan
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to