[Ohrrpgce] New nohrio RELOAD api feedback

David Gowers 00ai99 at gmail.com
Mon Oct 1 03:37:33 PDT 2012


On Mon, Oct 1, 2012 at 1:46 AM, Ralph Versteegen <teeemcee at gmail.com> wrote:
> I see. But what would this stream api actually look like (just when
> and next)? I think either iterating, indexing by child name, or elif
> chain would comfortably and naturally handle all the document
> structures we currently have (would have to review though).

Well, the idea is that it wouldn't look like anything -- you could
just node['subnodename'] and expect to get subnodename if it's
available at the current level. ie. no actual difference in API (aside
from having to ask for streaming when you open the document), just a
difference in whether the loading is lazy or not.

when() is probably going to go away in favor of the elif-chain pattern
you pointed out.
next() is actually just a standard Python iterating function, which in
most cases you wouldn't want to call manually (but maybe in some cases
where nodes are big you would.)

(In Python3. to manually get the next item from an iterator, you use
`next(iterator)`.
In Python2 it was `iterator.next()`)


.. Ah, so basically like I said -- no additional API. I just scrubbed
all the remaining streaming API :)


I'll start working on implementing this whole API soon if no other
points of clarification come up, cause it's hitting all the right
spots -- simple both in front and backend, unsurprising, easy things
are easy, complex things are possible. Yeah, I'm feeling pretty happy
with it :)


More information about the Ohrrpgce mailing list