xray7224/MegBot — Issue #2: Code duplication in MegBot.py 
Author: webpigeon
Created: 2011-12-06 17:09:31+00:00
State: open

Short curcit evaluation and be exploited to tidy up the if statement on line 71 of megbot.py, removing code duplication.

if not "active" in config.networks[network].keys() or config.networks[network]["active"]:
bots[network] = start_new_thread(Bot, (config.networks[network], coreplugins["hooker"].Hooker(), coreplugins, config))

The new line should not evaluate config.networks[network]["active"] if the first part not "active" in config.networks[network].keys() is true. This means no error about missing keys and you don't need duplication of the line creating a new thread.