[Python-3000] how to deal with compatibility problems (example: turtle module)
Gregor Lingl
gregor.lingl at aon.at
Tue May 27 22:48:25 CEST 2008
Hi,
when doing some final checking of the new turtle module I ran into the
following problem, which I'd like to discuss with the intention to clarify
how to handle problems that result more or less from suboptimal design
decisions of the module to replace.:
(1) As requested I added an __all__ variable to the new turtle module
to define those names, that will be imported by: from turtle import *
Of course I consider this very useful. (The old module didn't have an
__all__ variable)
(2) Moreover it was requested that the new turtle module be fully
compatible with the old one.
(3) The old module has a from math import * statement, which
results in importing all names from math when doing from turtle import *.
Moreover there are defined two functions in turtle.py which overwrite
the correspoding functions from math (namely degrees() and radians())
Is this a feature which should be retained? (I suppose that it was not
intended by the developer of the old turtle module but happened
somehow.)
If so, I had to add all names from dir(math) to my __all__ variable
(except those two mentioned above).
My personal opinion is, that this would be a rather ugly solution, and
I think that this 'feature' should at least be eliminated in the Python 3.0
version.
On the other hand one could argue, that most (if not all) of the functions
in math are normally not used by users of turtle, and those who use it
certainly know how to import what they need. So one could drop the
from math import * already in Python 2.6. But, of course, this argument
doesn't consider the possibility of breaking some old code.
I'm also interested in how to proceed with this, because there are a few
similar problems with the turtle module which should be solved with the
transition from Python2.6 to Python3.0
So, generally, which guidelines should one use to decide on problems like
this - and who is the one who decides?
With best regards
Gregor
More information about the Python-3000
mailing list