This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: turtle.py: correcting begin_fill
Type: Stage:
Components: Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: loewis Nosy List: gregorlingl, loewis
Priority: normal Keywords: patch

Created on 2006-07-09 14:42 by gregorlingl, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
turtle07092006.patch gregorlingl, 2006-07-09 14:42 patch for changing begin_fill()
libturtle.tex.patch gregorlingl, 2006-07-09 14:43 Adds two lines to the durtle.py Docs
Messages (2)
msg50638 - (view) Author: Gregor Lingl (gregorlingl) Date: 2006-07-09 14:42
In the current version of turtle.py begin_fill behaves
exactly like fill(True). That means, that a call
begin_fill() does a filling if another call
begin_fill() has been issued before. To see this, try:

>>> from turtle import *
>>> begin_fill()
>>> forward(100)
>>> left(50)
>>> forward(100)
>>> begin_fill()
>>>

Imho this is not very plausible. (Of course, calling
begin_fill twice is also not very plausible, but may be
done by beginners inadvertedly). I encountered
this problem first in a course for teachers I gave today.

I propose that begin_fill should behave differently,
namely start a new filling (as it's stated in the docs,
which are - as you see- in fact for this function
incomplete) and  discard the  butlast call  to
begin_fill.  If one really needed the current
functionality , one could resort to fill().

I discussed this with Vern Ceder at edupython list and
he replied:

Personally, my vote would be to fix it as you suggest
and submit the patch as soon as possible - it may just
be possible for it to make it into the 2.5 release.

--- 
Please note, that begin_fill was just added to 2.5, so
this slight change of functionality shouldn't create
problems.

So I submit a patch, which does this. This patch also
eliminates the attribute _tofill, which is not needed
anymore. (I think it was needed in the old circle
method). Moreover the forward(0) call at the end of the
definition of the fill method is eliminated as it does
nothing but unnecessarily duplicate a pair of
coordinates to the _path list

The patch contains also a short addition to the demo()
function, which shows that now concave forms can be filled.

Subsequently I'll add a short patch to the turtle.py
Documentation


msg50639 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2006-07-10 22:12
Logged In: YES 
user_id=21627

Thanks for the patch. Committed as r50553.
History
Date User Action Args
2022-04-11 14:56:18adminsetgithub: 43638
2006-07-09 14:42:06gregorlinglcreate