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.

Title: More useful repr for Tcl_Obj
Type: enhancement Stage: resolved
Components: Tkinter Versions: Python 3.4
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: gpolo, python-dev, rhettinger, serhiy.storchaka, terry.reedy
Priority: normal Keywords: patch

Created on 2013-09-16 08:47 by serhiy.storchaka, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit
tkinter_repr.patch serhiy.storchaka, 2013-09-16 08:47 review
Messages (4)
msg197881 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-09-16 08:47
Currently the repr() for Tcl_Obj is not very useful. It exposes only Tcl type name and Tcl object address.

>>> import tkinter.ttk
>>> tv = tkinter.ttk.Treeview()
>>> tv.tag_configure('test', foreground='blue')
>>> str(tv.tag_configure('test', 'foreground'))
>>> tv.tag_configure('test', 'foreground')
<color object at 0xb70f84b8>

You need explicitly call str to get more useful information. This is awkward when Tcl object hidden deeply in tuples or other data structure, or reported in a backtrace. Actually every Tcl object can be represented as a string. I propose to expose this representation in repr(). With proposed patch the output of the last command will be: <color object: 'blue'>.
msg198237 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2013-09-22 00:45
This looks more useful to me; it might make tests easier. But I cannot be sure no one would object.
msg198239 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2013-09-22 01:19
msg198331 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-09-23 19:49
New changeset ece634a69ba8 by Serhiy Storchaka in branch 'default':
Issue #19034: repr() for tkinter.Tcl_Obj now exposes string reperesentation.
Date User Action Args
2022-04-11 14:57:51adminsetgithub: 63234
2013-09-23 20:08:13serhiy.storchakasetstatus: open -> closed
assignee: serhiy.storchaka
resolution: fixed
stage: patch review -> resolved
2013-09-23 19:49:23python-devsetnosy: + python-dev
messages: + msg198331
2013-09-22 01:19:59rhettingersetnosy: + rhettinger
messages: + msg198239
2013-09-22 00:45:18terry.reedysetmessages: + msg198237
2013-09-16 08:47:32serhiy.storchakacreate