• maitre_kaio
The professor made a mistake in lecture 10: at the end of the lecture, he's introducing the use of exceptions, and illustrates it with the getGrades function. Here's his explaination: "And if I go ahead and run this -- now it's going to say woops, at me. What happened? I'm down here and try, I'm trying do get grades, which is a call to that function, which is not bound in my computer. That says it's in here. It's in this tri-block. It raised an exception, but it wasn't and I O error. So it passes it back, past this exception, up to this level, which gets to that exception."
MIT 6.00 Intro Computer Science (OCW)
  • Stacey Warren - Expert
Hey! We 've verified this expert answer for you, click below to unlock the details :)
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
  • jamiebookeater
I got my questions answered at in under 10 minutes. Go to now for free help!
  • maitre_kaio
Sorry I was limited by the size of questions :) Maybe I ujst didn't understand what he was trying to explain, but I think he's mistaken. So I think this is what really happened : 1. The program calls the getGrades function 2. Inside getGrades, fopen can't find the file named grades.txt, so fopen raises an IOError 3. Because fopen is in a try block, the except IOError blocked is interpreted. The IOError is replaced by a GetGradesError. This error bubbles up to the caller, the main program. 4. In the main program, GetGradesError is catched and the except block prints 'whoops'
  • anonymous
i think you got it and i think he misspoke.

Looking for something else?

Not the answer you are looking for? Search for more explanations.