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

Guido van Rossum guido at python.org
Tue May 27 22:57:28 CEST 2008


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

On Tue, May 27, 2008 at 1:48 PM, Gregor Lingl <gregor.lingl at aon.at> wrote:
> 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
>
>
>
> _______________________________________________
> Python-3000 mailing list
> Python-3000 at python.org
> http://mail.python.org/mailman/listinfo/python-3000
> Unsubscribe:
> http://mail.python.org/mailman/options/python-3000/guido%40python.org
>



-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list