[Python-Dev] please back out changeset f903cf864191 before alpha-2
Terry Reedy
tjreedy at udel.edu
Sat Aug 24 20:42:24 CEST 2013
On 8/24/2013 10:03 AM, Nick Coghlan wrote:
I have not used ET or equivalent, but I do have opinions on function names.
> Looking at the current documentation of ElementTree sets of alarm
> bells on that front, as it contains the following method descriptions
> for XMLParser:
>
> close()
> Finishes feeding data to the parser. Returns an element structure.
>
> feed(data)
> Feeds data to the parser. data is encoded data.
These are short active verbs, reused from other Python contexts.
>
> And these for IncrementalParser:
>
> data_received(data)
> Feed the given bytes data to the incremental parser.
Longer, awkward, and to me ugly in comparison to 'feed'. Since it seems
to mean more or less the same thing, why not reuse 'feed' and continue
to build on people prior knowledge of Python? Is this the 'tulip
inspired' part? If so, I hope the names are not set in stone yet.
> eof_received()
> Signal the incremental parser that the data stream is terminated.
What is the incremental parser supposed to do with the information?
Close ;-?
> events()
> Iterate over the events which have been encountered in the
> data fed to the parser. This method yields (event, elem) pairs, where
> event is a string representing the type of event (e.g. "end") and elem
> is the encountered Element object. Events provided in a previous call
> to events() will not be yielded again.
Plural nouns work well as iterator names: 'for event in events:'.
--
Terry Jan Reedy
More information about the Python-Dev
mailing list