Your Python code is just wrong. I'm not sure what you think it's proving when you write explicitly wrong Python code, and then show that the output is wrong.
Could you elaborate? I want to understand how to fix it.
EDIT: I really want to know what is wrong with my code. It works. Is it a stylistic concern?
$ dd bs=1m count=10 if=/dev/random of=randomdata
10+0 records in
10+0 records out
10485760 bytes transferred in 0.878533 secs (11935535 bytes/sec)
$ python stdin_to_stdout.py < randomdata | cmp - randomdata
$ echo $?
0
EDIT2: I think I know how you came to the conclusion my code is wrong. Perhaps next time you should read the __entire__ post. Thank you.