Migrating Tcl system to Python

Moshe Zadka moshez at math.huji.ac.il
Mon Apr 10 01:11:54 EDT 2000

On Sun, 9 Apr 2000, Hamish Lawson wrote:

> The systems will be on Linux so COM is out but the rest are
> possibilities. As far as I can see, one of the main issues in
> communicating between Tcl and Python will be how to handle
> passing lists and dictionaries (arrays in Tcl). XML-RPC manages
> this automatically and although I don't have any experience with
> either CORBA or ILU, I imagine they do too. If I were to use a
> pipe approach, there would presumably be a need for a layer to
> translate between Tcl's and Python's representations of data
> structures; though I think this might be reasonably simple, are
> there solutions already available, or issues I'd need to be
> aware of?

Tcl has exactly two types: strings, and arrays mapping strings to
strings. The problem is that those are often used to create
data-structures in strange and unpredictable ways. Hence, no good
general solution will probably be available. For simple enough cases,
two Tcl commands "marshal_string" and "marshal_array" which will
create Python expression for strings and dicts will suffice. Just send
these over a socket, and have a Python "eval" at the other side.
Moshe Zadka <mzadka at geocities.com>. 
http://www.linux.org.il -- we put the penguin in .com

More information about the Python-list mailing list