This is a great idea. I can't tell much from the image you provided about how the code samples are distinguished from the rest of the text. Usually you want code samples in a slightly different font - say a monospaced font - from the rest of your text. And then there's the problem of line wrapping in code samples - in an indentation-sensitive language like Python, that could be more of a problem but even in cases where it doesn't mislead the reader about the way the language works, it could be unsightly. Perhaps you haven't gotten that far yet or someone else will improve upon it and contribute the patches back to you. Great start, though. I was resolute about not getting an iPad but this is the first really good argument I've seen in its favor.