Nick Coghlan added the comment:

Since parsers don't support changing the target after creation, I think it 
makes sense to deprecate passing in a parser *instance*, and instead require 
passing in a callback that accepts the target to use and *returns* an 
appropriate parser object. The "parser can only use the default TreeBuilder as 
a target." line in the iterparse docs is a sign that this is a more appropriate 
API - if iterparse needs a particular kind of target, the API should be 
designed so iterparse *provides* that target instead of saying "please don't 
use a custom target type".

However, I don't think it makes sense to provide such a callback based API 
until it is actually possible to implement the streaming event API using a 
custom target object with XMLParser.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17741>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to