Overview
| Artifact ID: | 1aaa05b16d49c7f671fa5b131729ded9817320696dfb57410cb9acc98711fbd2 |
|---|---|
| Ticket: | b5bd08df8d61b4ea9bf0cc885f790b367c430a9f
The "int" type registration should be restored. |
| User & Date: | marc_culler on 2024-07-03 13:05:30 |
Changes
- icomment:
I am repeating a comment I made on the core list, for the record. The Python tkinter module can create an embedded Tcl interpreter (with the Tk package loaded) and provides the ability to run arbitrary Tcl commands in the interpreter. Therefore _tkinter.c needs to be able to convert any Tcl_Obj to a Python object. In some cases that Python object may be a mostly useless object which just records the type name of the Tcl_Obj but most of the core Tcl object types have meaningful representations as Python objects. Below is a snippet from a Python interpreter session in which a Tcl bignum is converted to a Python int. An instance of the Python class tkinter.Tk is an encapsulation of a Tcl interpreter, although many tkinter users don't know this and think it is only encapsulating the root window. It has a call method which can be used to run an arbitrary Tcl command. $ python3 Python 3.11.8 (v3.11.8:db85d51d3e, Feb 6 2024, 18:02:37) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import tkinter >>> interp = tkinter.Tk() >>> x = interp.call('expr', '11111111111111111111', '*', '22222222222222222222') >>> print(x) 246913580246913580241975308641975308642 >>> type(x) <class 'int'> While I don't know of any use for, say, tclExprCodeType in Python, I think we are providing a general purpose tool and we should make it as useful and as transparent as possible without second-guessing how it will be used in the future. And, obviously, Python is not the only client for such a tool. - login: "marc_culler"
- mimetype: "text/plain"
- username: "Marc Culler"