sgmlParser infinite loop? How to empty and re-user parser object?

Aahz aahzpy at panix.com
Sat Mar 23 02:22:06 EST 2002


In article <mailman.1016845955.10065.python-list at python.org>,
Nick Arnett <narnett at mccmedia.com> wrote:
>
>I was getting it sometimes every dozen or two documents, but... I
>realized I wasn't calling reset properly -- I was leaving off the empty
>parentheses, which produces no error, but doesn't actually reset the
>object, apparently.  That seems to have improved things considerably,
>but not completely.

Not really up for dealing with your actual question, but I wanted to
demonstrate the "bug" you found in a more interesting context:

    def red():
        print "red"
    
    def green():
        print "green"
    
    switch = {'red':red, 'green':green}
    switch[getColor()]()

Fun, huh?
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"We should forget about small efficiencies, about 97% of the time.
Premature optimization is the root of all evil."  --Knuth



More information about the Python-list mailing list