Steven D'Aprano wrote:
> On Tue, 01 Jan 2008 13:36:57 +0100, Diez B. Roggisch wrote:
> 
>> And codemonkeys know that in python
>>
>> doc = et.parse(StringIO(string))
>>
>> is just one import away
> 
> Yes, but to play devil's advocate for a moment, 
> 
> doc = et.parse(string_or_file)
> 
> would be even simpler.

I assume the problem with this is that it would be ambiguous. You can 
already use either a string or a file with ``et.parse``. A string is 
interpreted as a file name, while a file object is used directly.

How would you differentiate between a string that's supposed to be a 
file name, and a string that's supposed to be XML?

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

Reply via email to