(reported on the pydotorg mailing list).
\verbatiminput instead of the verbatim environment -- this does the "right thing" regarding page breaks in long examples for the typeset formats, and has nice benefits for the HTML version as well.