Toby Donaldson wrote:
> Hi,
> However, I have two concerns. First, why are we passing in a *number*
> to speed when there are only 5 discrete speeds? (Or do decimal values
> make a difference, e.g. is a speed of 2.5 meaningful?) It forces the
> programmer to remember the mapping of numbers and speeds. I would
> prefer something like this:
>
> def speed(self, speed='medium'):
> """Sets the turtle speed to be one of 5 values: 'slowest',
> 'slow', 'medium',
> 'fast', 'fastest'. """
>
> sp = {'slowest' : 0, 'slow' : 1, 'medium' : 2, 'fast' : 3, 'fastest' :
> 4}
> self._delay = 20 - (sp[seed] * 5)
I completely agree and have already done something similar in the newest
version.
> A second more general issue that this touches upon is the general
> turtle.py policy for handling errors. There seem to be two main
> possibility: when turtle function is given bad data, ignore it, or
> crash. Gregor's speed function is a nice example of the "ignore bad
> data" policy, but that's consistent throughout turtle.py (e.g. the
> color setting function crashes in a variety of ways if you give it bad
> data).
>
> Should turtle.py have a more consistent error-handling policy? Candidates
> are:
I was thinking about this as well, and I agree that normalizing of the
parameters should be done. But beyond that, I started thinking of
something else:
"Errors should never pass silently."
"Unless explicitly silenced."
So I guess I'm thinking we should have respond to all errors, but as
helpfully as possible. "bad speed" isn't helpful, but "Speed must be one
of 'fastest', 'fast', 'normal', 'slow', 'slowest'" is helpful.
Vern
--
This time for sure!
-Bullwinkle J. Moose
-----------------------------
Vern Ceder, Director of Technology
Canterbury School, 3210 Smith Road, Ft Wayne, IN 46804
[EMAIL PROTECTED]; 260-436-0746; FAX: 260-436-5137
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"edupython" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/edupython
-~----------~----~----~----~------~----~------~--~---