All pastes #1378019 Raw Edit

Anonymous

public python v1 · immutable
#1378019 ·published 2009-03-31 16:14 UTC
rendered paste body
def range_goto(reader):    from canto.input import input    term = input(reader.cfg, "Goto")    if not term:        return    links = []    terms = term.split(',')    for t in terms:        try:            links.append(int(t))        except:            if t.count('-') == 1:                d = t.index('-')                a = t[:d]                b = t[(d+1):]                try:                    a = int(a)                    b = int(b)                except:                    reader.cfg.log("Unable to interpret range!")                    return                for l in xrange(a,b + 1):                    links.append(l)            else:                reader.cfg.log("Unable to interpret command!")                return    reader.cfg.log("Going to: %s" % links)    for l in links:        reader.dogoto(l)reader_keys['g'] = range_goto