On Thu, Sep 22, 2016 at 12:39 AM, ROGER GRAYDON CHRISTMAN <d...@psu.edu> wrote:
> Which only highlights my disappointment that my tree
> traversal itself was O(n log n), unless I gave up on yield.
> As a teacher I'm stuck with either
> a) a data structure that can only get its maximal speed
> by not having any iterator in the normal sense
> (which in my mind sounds non-Pythonic)
> b) can support iteration, but then is no better than a
> dict in any way, except for maybe some rare operation like
> "identify the minimal value"
c) Reject the notion that speed is somehow linked to "number of yield
operations", until such time as you actually have proof of that
d) Use "yield from" and declare and/or assume that it is optimized,
which it quite probably will be.
The cost of a yield action is pretty minimal. Don't worry about it.