[Python-3000] how to deal with compatibility problems (example: turtle module) (original) (raw)

Gregor Lingl gregor.lingl at aon.at
Tue May 27 23:40:57 CEST 2008


Guido van Rossum schrieb:

The old turtle.py explicitly says

from math import * # Also for export so I think it's desirable to keep this behavior. My intent with that line was that an absolute beginner could put "from turtle import *" in their interactive session and be able to use both the turtle code and the high-school math functions that might come in handy, like sin() and cos(). The other math functions don' really hurt I believe. Where there's a naming conflict, obviously the turtle module wins. --Guido Thanks for the quick reply, I'll do it this way.

Gregor

P.S.: I'd just like to add one (critical) remark which results from some decades working as a highschool teacher and (nearly) one decade working with Python, and especially turtle graphics with highschool students:

sin() and cos() imported from math work with radians. The default angle-mode for turtle is degrees. So when using trig-functions I have to talk about radian measure and conversion of angle units. To calculate the sine of 30 degrees for instance I had to call sin(radians(30)) etc., but unfortunately just this radians() functions is not available anymore when doing from turtle import *. So in this case this import is of limited use. And it definitely makes sense to tell highschool students that sin(), cos() and friends live in a module called math.



More information about the Python-3000 mailing list