Harry moved in front of the tank and looked intently at the snake. He wouldn’t have been surprised if it had died of boredom itself– no company except stupid people drumming their fingers on the glass trying to disturb it all day long. It was worse than having a cupboard as a bedroom, where the only visitor was Aunt Petunia hammering on the door to wake you up; at least he got to visit the rest of the house.
J.K. Rowling, HPSS, “The Vanishing Glass”
So Harry looks at this snake and his first thought is that it has it worse than him. Harry feels pity for the snake because Harry gets to visit the house outside his cupboard. That’s the high point of Harry’s living situation. He gets to walk through other rooms. This poor snake doesn’t get to do that. HARRY IS SO PRECIOUS HERE.
I’ve never really paid attention to his compassion much in previous reads, so I guess the great thing about it having been so long is I’m going to cry over him a lot now.