Yeah, definitely depends on the stage and how many days a week or how many hours a day you need to be there.
I'm commuting for my masters right now because I work and own a house in one city and grad school is in a city about 90 miles away. Just finished my third year of this and it's really starting to get old. I average 2 days a week most weeks but two semesters it was 3 days a week as my classes are generally M,W or T,Th, but occasionally had to do T, W, Th. Due to weather and road construction I generally give myself an hour and 45 minutes to 2 hours to get there. Based on this experience, I wouldn't commute more 40 minutes to years 1 & 2 for medical school and closer for years 3 & 4.
*edit, my willingness to commute like 40 minutes during med school is based on the fact that I have two mutts and am probably not going to be able to swing apartment living with them and to save on housing costs as a result by not living in "city center." Also, I'm a small town girl, so it fits me better to be a bit outside the hustle and bustle. But I'll get as close as I can while still trying to meet my requirements.