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: changed return type from tkinter.Canvas.coords
Type: behavior Stage: resolved
Components: Tkinter Versions: Python 3.1, Python 3.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: SilentGhost, ajaksu2, belopolsky, eric.araujo, gpolo, petraszd
Priority: low Keywords: easy, patch

Created on 2009-09-10 17:25 by SilentGhost, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
fix-6878.patch eric.araujo, 2010-05-09 14:21 write the fix proposed by Daniel
fix-6878-with-tests.patch petraszd, 2010-07-23 11:48 patch with tests for Canvas.coords
issue6878.diff belopolsky, 2010-10-21 18:02 review
Messages (12)
msg92495 - (view) Author: SilentGhost (SilentGhost) * (Python triager) Date: 2009-09-10 17:25
Doc string for tkinter/__init__.py Canvas.coords (line 2115 in
python3.1.1) reads: """Return a list of coordinates for the item given
in ARGS."""

actual code: return map(...etc...)

I actually don't know whether it's an outdated docstring, may be coords
should return a tuple.
msg102652 - (view) Author: Daniel Diniz (ajaksu2) * (Python triager) Date: 2010-04-08 23:21
I think the obvious code fix of list(map()) is less likely to cause surprises than updating the docstring to the new map in 3.x.
msg105396 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-05-09 14:21
Attaching patch based on py3k, please review. (Mercurial diff, use patch -p1)
msg105406 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2010-05-09 18:13
Weird.. I was almost sure that was fixed at some point.

The patch is fine, but I would suggest adding some simple testcase(s).
This will probably require a new file (test_canvas.py) at
Lib/tkinter/test/test_tkinter.
msg111283 - (view) Author: Petras Zdanavičius (petraszd) * Date: 2010-07-23 11:48
I have added tests.
msg111284 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-07-23 11:50
Looks good to me. Thanks!
msg119322 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-10-21 17:48
Searching through tkinter for map() calls reveals many other places where map object is returned instead of a list.  For example:

    def keys(self):
        """Return a list of all resource names of this widget."""
        return map(lambda x: x[0][1:], ..

    def pack_slaves(self):
        """Return a list of all slaves of this widget                                                                                                                    
        in its packing order."""
        return map(self._nametowidget, ..

    def place_slaves(self):
        """Return a list of all slaves of this widget                                                                                                                    
        in its packing order."""
        return map(self._nametowidget, ..


    def wm_colormapwindows(self, *wlist):
        ...
        Return current list of widgets if WLIST is empty."""
        return map(..

While in some cases it may be arguable that returning an iterable is more appropriate for 3.x, I believe preserving backward compatible API is more important.   API changes should also be accompanied with 2to3 fixes, so some action is required in any case.
msg119323 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-10-21 18:02
Attached patch fixes other uses of map() in tkinter.
msg119350 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-10-21 22:55
Looks good.  Would look better with tests, and even slightly better with consistent indentation :)
msg122158 - (view) Author: SilentGhost (SilentGhost) * (Python triager) Date: 2010-11-22 19:28
In my original post, I mentioned that it might be just a documentation issue. Could someone confirm that having map object returned is actually causing any problems?
msg122160 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-11-22 19:49
Committed in r86697 (3.2) and r86698 (3.1).

@Éric: I tried to minimize whitespace changes in the commit, but if you see indentation that can be improved, let me know and I'll fix it separately.

@SilentGhost: Yes, the problem is real.  For example, turtle module had to be fixed to work around the API change.  I now reverted that.  Note that 2to3 (I believe) fixes direct invocations of map, but cannot look inside the functions.
msg122598 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-11-28 01:52
tkinter/__init__.py and tix.py are not consistent throughout with their indentation, your commit did not add hard to read code, so it’s okay.
History
Date User Action Args
2022-04-11 14:56:52adminsetgithub: 51127
2010-11-28 01:52:20eric.araujosetmessages: + msg122598
2010-11-22 19:50:51belopolskysetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2010-11-22 19:49:52belopolskysetmessages: + msg122160
2010-11-22 19:28:07SilentGhostsetmessages: + msg122158
2010-10-21 22:55:02eric.araujosetmessages: + msg119350
2010-10-21 18:02:45belopolskysetfiles: + issue6878.diff

messages: + msg119323
2010-10-21 17:48:13belopolskysetmessages: + msg119322
2010-10-21 17:31:52eric.araujosetnosy: + belopolsky

versions: + Python 3.2
2010-10-21 17:30:58eric.araujolinkissue10168 superseder
2010-07-23 11:50:51eric.araujosetmessages: + msg111284
2010-07-23 11:48:52petraszdsetfiles: + fix-6878-with-tests.patch
nosy: + petraszd
messages: + msg111283

2010-05-09 18:13:37gpolosetmessages: + msg105406
2010-05-09 14:21:04eric.araujosetfiles: + fix-6878.patch

title: outdated docstring in tkinter.Canvas.coords -> changed return type from tkinter.Canvas.coords
keywords: + patch
nosy: + gpolo, eric.araujo

messages: + msg105396
stage: needs patch -> patch review
2010-04-08 23:21:08ajaksu2setpriority: low

type: behavior

keywords: + easy
nosy: + ajaksu2
messages: + msg102652
stage: needs patch
2009-09-10 17:25:07SilentGhostcreate