Madrillenos have their own techniques for dealing with the heat of the city in July.
Those who don't have a long commute back home may still have a big midday meal and an afternoon siesta before returning to work until evening. But many do commute. I imagine they take advantage of air-conditioned offices as much as possible.
A tourist wants to see things, but when it gets to be over 100 degrees, she gets more than hot.
After I more-or-less got over my jet-lag I had forced myself to stay out all day. I was just miserable. After I came close to passing out on the metro, I came up with my strategy for beating the heat. I developed a modified Spanish plan. I set my alarm and got up at 6:00 in the morning to got out walking different neighborhoods, and taking photographs. In the late morning I visited any museums or other tourist attractions. Once it got good and hot in the early afternoon, I went back to my hotel room, showered off the heat, ate my yogur y frutas and whatever I had scrounged from the mercado. Then I had a REALLY LONG nap, really the second part of my nights sleep. I got up really late in the afternoon and went out walking again. This always included hanging out in El Parque el Buen Retiro. That's where the locals were anyway. Once I got tired of walking in the park, I sat on various benches and read or sketched. I also hung out at the turtle pond and chatted to people. (See my previous entry, Getting Neighborly).
Madrid stayed light until after 10:00 at night in July. Several times I stayed out until past 11:00. The Plazas are well-lit and, since I saw other home-bound women walking home at that time of night. From the style of dress of the people I saw, I guessed that the walk back to the hotel was relatively safe. A casual supper in my hotel room, a little English language news on t.v. and I got in another 5 hours or so of sleep.
Early evening at El Lago in El Parque de Buen Retiro