While understanble, I hate this. "Here's 100 pages of python before we get to the good stuff", which ends up not even being good.
Publishers should just offer a free e-book of said language, and make it a requirement.
It decreases the amount of boilerplate "how to program in X" text you have to write. Producing text, especially novel text, is expensive in a non-fiction book.