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.

Author serhiy.storchaka
Recipients kumba, serhiy.storchaka, terry.reedy
Date 2018-03-16.09:24:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1521192266.17.0.467229070634.issue32328@psf.upfronthosting.co.za>
In-reply-to
Content
> If the issue really boils down to incorrectly passing a single string when there is only one item in 'values', and a single-item tuple should be used instead, then shouldn't the better solution be for Python to handle this automatically and re-cast the errant string into a tuple?

Tkinter is rather a thin wrapper around Tcl/Tk. I just passes values to Tcl. Tcl is a weak typed language. Internally it can use different types for performance, but semantically all are strings. "a b" is a string and a 2-element list, and a 1-element dict at the same time. It is Tcl try to re-cast the errant string into a Tcl list, and fails because it has incorrect syntax. Python can't know your intention. It supposes that you know what you do. If under re-casting you meant passing a string to a tuple constructor, `tuple(values)`, this will be obviously wrong. If your meant parsing a string to a tuple at Python side -- it will file as well as parsing it at Tcl side. If you meant wrapping a string into a one-element tuple, `(values,)`, this can break working code when a user intentionally passes a space separated list of words:

    tv.insert("", END, values=(foo, bar), tags="foo bar")

Additionally, any special cases will complicate the code of Tkinter (currently it is rather a thin wrapper) and complicate the mental model.
History
Date User Action Args
2018-03-16 09:24:26serhiy.storchakasetrecipients: + serhiy.storchaka, terry.reedy, kumba
2018-03-16 09:24:26serhiy.storchakasetmessageid: <1521192266.17.0.467229070634.issue32328@psf.upfronthosting.co.za>
2018-03-16 09:24:26serhiy.storchakalinkissue32328 messages
2018-03-16 09:24:26serhiy.storchakacreate