Lies in education [was Re: The "loop and a half"]
bartc
bc at freeuk.com
Fri Oct 13 09:51:54 EDT 2017
On 13/10/2017 14:16, Chris Angelico wrote:
> On Sat, Oct 14, 2017 at 12:00 AM, bartc <bc at freeuk.com> wrote:
>> Even if data is actually in write-protected memory, attempts to write to it
>> will cause a crash. On my home-made system, they just did nothing. Much more
>> graceful.
>
> The novice thinks his job is to stop the program from crashing. The
> expert knows that a crash is actually far FAR better than silently
> doing nothing.
For a novice, seeing 'Segmentation fault (core dumped)' is better?
There, a friendlier, more useful error message is called for ('writing
into read-only memory' is a good start).
But the idea of having memory which is permanently or temporarily
write-protected is also useful: you can do what you like to it and it
won't change, and such an attempt wouldn't necessarily be an error.
For example, you're drawing a series of points or connected lines into a
window to form a shape. But part of the shape is outside the window. So
you fix the logic and try again. You don't want it to crash if you gave
it coordinates (corresponding to memory beyond the window limits)
outside the boundaries.
It's just a technique, like greying out certain menu options - clicking
them will do nothing, but you won't get an error message and you don't
want to allow them anyway, risking more serious consequences.
--
bartc
More information about the Python-list
mailing list