On Mon, May 21, 2012 at 2:52 AM, e-mail mgbg25171 <mgbg25...@blueyonder.co.uk> wrote: > def rJnz (cod,p) : return (cod[p],p+1)[ds.pop()] > def rJz (cod,p) : return (p+1,cod[p])[ds.pop()==0] > > Specifically I'm stuck on what (code[p], followed by p+1 does inside the > brackets
(cod[p],p+1) is a two-item tuple with [0] equal to cod[p] and [1] equal to p+1. It takes the next element off the list ds and indexes that little tuple with it. It's like this: def rJnz (cod,p): if ds.pop()==1: return p+1 return cod[p] def rJz (cod,p): if ds.pop()==0: return cod[p] return p+1 > ds.pop() == 0 either means that the result popped is 0 or that there are no > items left in list ds[] If there are no items left. pop() will raise an exception. ChrisA -- http://mail.python.org/mailman/listinfo/python-list