A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2001-August/017316.html below:

[Python-Dev] python generator design bug?

[Python-Dev] python generator design bug? [Python-Dev] python generator design bug?Neil Schemenauer nas@python.ca
Mon, 27 Aug 2001 09:23:49 -0700
Eric Kidd thinks so:

    http://www.advogato.org/person/emk/

Here's an excerpt:

    [...] there's a subtle bug in the Python design. Consider tree
    traversal:

    def inorder(t):
        if (t.left != None):
            for (node in inorder(t.left)):
                yield node
        yield t
        if (t.right != None):
            for (node in inorder(t.right)):
                yield node

    If you study this carefully, you'll see that (unless the optimizer
    intervenes), Python has turned a perfectly good O(N) tree traversal
    into an O(N log N) traversal.

Thoughts?

  Neil



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4