New submission from Serhiy Storchaka:

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'))
'blue'
>>> 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'>.

----------
components: Tkinter
files: tkinter_repr.patch
keywords: patch
messages: 197881
nosy: gpolo, serhiy.storchaka, terry.reedy
priority: normal
severity: normal
stage: patch review
status: open
title: More useful repr for Tcl_Obj
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file31791/tkinter_repr.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19034>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to