Skip to content

Turtle dot function not accepting color parameter. #138772

Description

@Atticus-Beard

Bug report

Bug description:

Turtle dot function not accepting color parameter.

# Add a code block here, if required
import random
from turtle import Turtle, Screen


turtle = Turtle

color_list = [(198, 13, 32), (248, 236, 25), (40, 76, 188), (244, 247, 253), (39, 216, 69), (238, 227, 5), (227, 159, 49), (29, 40, 154), (212, 76, 15), (17, 153, 17), (241, 36, 161), (195, 16, 12), (223, 21, 120), (68, 10, 31), (61, 15, 8), (223, 141, 206), (11, 97, 62), (219, 159, 11), (54, 209, 229), (19, 21, 49), (238, 157, 216), (79, 74, 212), (10, 228, 238), (73, 212, 168), (93, 233, 198), (65, 231, 239), (217, 88, 51), (6, 68, 42), (176, 176, 233), (239, 168, 161), (249, 8, 48), (5, 246, 222), (15, 76, 110), (243, 15, 14), (38, 43, 221)]

turtle.begin_fill(Turtle())
Turtle.dot(color=random.choice(color_list), size=25)

screen = Screen()
screen.colormode(255)
screen.exitonclick()

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

Linked PRs

Activity

  1. JanEricNitschke commented on Sep 11, 2025

    @JanEricNitschke
    Contributor

    Error definitely happens, i can reproduce this on WSL and Windows all the way back to 3.9 (havent tested further)

    n$ python my_test.py
    Traceback (most recent call last):
      File "/mnt/d/Programming/Projects/cpython/my_test.py", line 11, in <module>
        Turtle.dot(color=random.choice(color_list), size=25)
        ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    TypeError: RawTurtle.dot() got an unexpected keyword argument 'color'
    
    
  2. JanEricNitschke commented on Sep 11, 2025

    @JanEricNitschke
    Contributor

    But isnt that just how the signature turtle.dot(size=None, *color) is supposed to work? There is no single argument "color" that you could address via keyword. We have "*args" which are just named "*color" here.

  3. added
    stdlibStandard Library Python modules in the Lib/ directory
    on Sep 11, 2025
  4. JanEricNitschke commented on Sep 11, 2025

    @JanEricNitschke
    Contributor

    Maybe the docs should be clearer on the expected syntax?

    There also seem to be exactly no tests for Turtle.dot() unless i am missing something: https://github.com/python/cpython/blob/main/Lib/test/test_turtle.py#L568

    and a search over the whole repo for ".dot(" only brings up the docstring (and docs).

    $ grep -R -n '\.dot(' .
    ./Doc/library/turtle.rst:793:      >>> turtle.dot()
    ./Doc/library/turtle.rst:794:      >>> turtle.fd(50); turtle.dot(20, "blue"); turtle.fd(50)
    ./Lib/turtle.py:3474:        >>> turtle.dot()
    ./Lib/turtle.py:3475:        >>> turtle.fd(50); turtle.dot(20, "blue"); turtle.fd(50)
    Binary file ./Lib/__pycache__/turtle.cpython-315.pyc matches
    
    
  5. Atticus-Beard commented on Sep 11, 2025

    @Atticus-Beard
    Author

    In my opinion, the documentation is not the issue. When I attempt to provide a color parameter as specified in the documentation https://docs.python.org/3/library/turtle.html#turtle.dot I encounter an error. Similarly, if I omit the color parameter, I also encounter an error.

  6. JanEricNitschke commented on Sep 11, 2025

    @JanEricNitschke
    Contributor

    @PortalWalkerCodes that link you provided goes to nowhere.

    Also you are doing Turtle.dot instead of Turtle().dot and dot is not a class method.

    Also alternatively it is a top level function

    import turtle
    from turtle import Turtle
    
    my_turtle = Turtle
    my_turtle.dot(...)
    turtle.dot(...)
    
    

    Work, but

    Turtle.dot()
    
    

    does not.

  7. added 2 commits that reference this issue on Sep 25, 2025
  8. added a commit that references this issue on Sep 25, 2025
  9. added a commit that references this issue on Sep 25, 2025
  10. added a commit that references this issue on Oct 7, 2025
  11. added a commit that references this issue on Oct 13, 2025
  12. added 2 commits that reference this issue on Oct 13, 2025
  13. added 2 commits that reference this issue on Oct 13, 2025
  14. added a commit that references this issue on Nov 4, 2025
  15. added a commit that references this issue on Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions