]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-65772: Clean-up turtle module (#104218)
authorTerry Jan Reedy <tjreedy@udel.edu>
Sat, 6 May 2023 15:04:41 +0000 (11:04 -0400)
committerGitHub <noreply@github.com>
Sat, 6 May 2023 15:04:41 +0000 (11:04 -0400)
commite407661e7a70ad49a69df3058634bc4fccebbcd6
tree6b4fbf6421744ed694ccffe673b4fa166d288f7a
parent6616710731b9ad1a4e6b73696e8bd5c40cf8762d
gh-65772: Clean-up turtle module (#104218)

* Remove the unused, private, and undocumented name `_ver` and
the commented-out `print` call.

* Don't add math functions to `__all__`.  Beginners should learn
to `import math` to access them.

* Gregor Lindel, who wrote this version of turtle, dropped plans
to implement turtle on another toolkit at least a decade ago.
Drop `_dot` code preparing for this, but add a hint comment.

* `_Screen` is meant to be a singleton class.  To enforce that,
it needs either a `__new__` that returns the singleton or
`else...raise` in `__iter__`.  Merely removing the `if` clauses
as suggested might break something if a user were to call `_Screen`
directly.  Leave the code alone until a problem is evident.

* Turtledemo injects into _Screen both _root and _canvas,
configured as it needs them to be.  Making _canvas an `__init__`
option would require skipping some but not all of the lines under
'if _Screen._canvas is None:`.  Leave working code alone.
Lib/turtle.py
Misc/NEWS.d/next/Library/2023-05-05-18-52-22.gh-issue-65772.w5P5Wv.rst [new file with mode: 0644]