https://gist.github.com/4467595
Running this code in pythonista causes the app to crash entirely... It's related to the bug in my code (after d[0]=0 I should return d, if I add in that line then it works a charm). It's funny that an app so stable might have one tiny little circumstance which would probably never happen... I'd be interested in hearing about what in the app's code caused this bug :D
Edited to use a gist cos otherwise a distinct lack of tabulation occurs.