I've done a little bit of tracing. The problem definitely occurs in py-shell-manage-windows which is called from py-shell in turn called from python-mode. Even though the py-shell call is wrapped in a save-excursion, once you enter py-shell-manage-windows, the buffer pops up and does not get hidden.
I haven't had time to trace py-shell-manage-windows yet. Maybe the above is enough to give you a hint as to the problem.
I've done a little bit of tracing. The problem definitely occurs in py-shell- manage- windows which is called from py-shell in turn called from python-mode. Even though the py-shell call is wrapped in a save-excursion, once you enter py-shell- manage- windows, the buffer pops up and does not get hidden.
I haven't had time to trace py-shell- manage- windows yet. Maybe the above is enough to give you a hint as to the problem.
FWIW, I'm on Ubuntu Raring, Emacs version 23.4.1