In article <[EMAIL PROTECTED]>, Paddy <[EMAIL PROTECTED]> wrote: > >What I ran was more like the version below, but i did a quick >separation of the line that has the ';' in it and goofed. > >>>> def interv2(inlist): >... for i,val in enumerate(inlist): >... if i==0: >... tmp = val >... elif val != valinc: >... yield [tmp, valinc]; tmp = val >... valinc = val+1 >... yield [tmp, valinc] >... >>>> list(interv2(inlist)) >[[3, 4], [6, 9], [12, 14], [15, 16]]
Fails on an empty list, as tmp is not defined when it hits the yield -- Jim Segrave ([EMAIL PROTECTED]) -- http://mail.python.org/mailman/listinfo/python-list