Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Why tcl instead of python

412 views
Skip to first unread message

Cecil Westerhof

unread,
Jan 29, 2018, 6:14:07 AM1/29/18
to
I started with tcl and like it. But I am asked why I use tcl instead
of python. People find that more logical and because I can program in
python they are flabbergasted.

I am better in writing software as this kind of discussions. What
would be good arguments to get those people of my back? ;-)

--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

Juge

unread,
Jan 29, 2018, 7:52:37 AM1/29/18
to
There are quite a few other programming languages as well. Why python, why not C++, for example? I think it depends on the boundary conditions. I use commercial software where couple of them have a Tcl API - no use beating the bush about python. I have another program which takes routines in python and in fortran, I can forget Tcl for a plugin.

Other than that if I need to get something done I need to look what is available on the platform. If I need to have something done quickly in the office, there is no use discussing with the admins about getting some compiler installed on my machine. It is quicker to take one that is already available. If I want to plug in something to Excel I go for Visual Basic, if I am on Linux I might go for a shell script. Tcl and python are both good for own GUIs and making the stuff platform independent.

It is all a matter of getting the job done. If you are working together with other SW engineers and developing something together, then usually the language is defined for the whole project. No use doing bits in C++ and the others in perl or python.

If you are doing some simple matters for yourself without any need to share with other engineers you might just want to take the language that you're most fluent in, then it is a matter of taste...

Juge

unread,
Jan 29, 2018, 8:01:13 AM1/29/18
to
By the way I had some trouble with python and admins as our python installation was lacking some libraries. They absolutely refused to install them without a tedious applications and stuff like that. I am loath to have these discussions. For Tcl I have this impression that I can more easily plugin available packages from internet directly into my code with no need to incorporate them on the central installation...just an impression, but I am not that deep into python, to be fair...

Gerald Lester

unread,
Jan 29, 2018, 10:00:45 AM1/29/18
to
On 01/29/2018 05:07 AM, Cecil Westerhof wrote:
> I started with tcl and like it. But I am asked why I use tcl instead
> of python. People find that more logical and because I can program in
> python they are flabbergasted.

You should use the language that is correct for the company/team.

As to why, when it does not matter which language or the choice is open
*and* Tcl/Tk is an appropriate choice, my answer is normally because
Tcl/Tk will let me develop the code faster than the other languages.


--
+----------------------------------------------------------------------+
| Gerald W. Lester, President, KNG Consulting LLC |
| Email: Gerald...@kng-consulting.net |
+----------------------------------------------------------------------+

two...@gmail.com

unread,
Jan 29, 2018, 2:41:07 PM1/29/18
to
On Monday, January 29, 2018 at 3:14:07 AM UTC-8, Cecil Westerhof wrote:


> What would be good arguments to get those people of my back? ;-)

I use tcl/tk on both windows and android. On windows, the twapii package is my best friend; it gives me control over nearly anything one might need to do w/o needing to understand the low level windows apis. It is also superb at simulating keystrokes and mouse movement so one can script things that are tedious to do by hand.

On android, I have created several scripts that let me control many devices using tcp and http programming with a gui interface that works with touch using androwish.

Tclkits and starkits let me install tcl/tk on machines by simply copying a single file.

I've used python, but only to experiment with a raspberry pi. It does seem well suited for that.




Gerald Lester

unread,
Jan 29, 2018, 3:53:12 PM1/29/18
to
Tcl/Tk also works great with the Raspberry PI!

Donal K. Fellows

unread,
Jan 29, 2018, 7:21:31 PM1/29/18
to
On 29/01/2018 11:07, Cecil Westerhof wrote:
> People find [Python] more logical [than Tcl] and because I can program in
> python they are flabbergasted.

I use Python at work (at the moment, but it's required for the project)
and I simply don't like it as much as Tcl. With a Tcl program, there are
very few surprises due to objects mutating where you can't see them;
that's extremely not the case for Python.

Another aspect of my distaste is that Python's system of doing classes
and packages just feels nasty to me, particularly with the proliferation
of magical variables for various things. There's simply a lot of Python
code that is outright difficult to read simply because it is written to
be super-efficient above all else. The mysterious names with magical
implications just abound (and often aren't well documented either).

Also, Python and threads are not a happy combination.

But for all that, Python isn't entirely bad for people who just stick to
the surface of the language (providing they like the syntax thing, which
is a mostly minor irritant). The problems are all deeper, and many users
simply don't go that far down.
--
Donal Fellows — Tcl user, Tcl maintainer, TIP editor.

Robert

unread,
Jan 29, 2018, 10:09:15 PM1/29/18
to
I like Tcl.

That's really all you need to say.

--
Bob

two...@gmail.com

unread,
Jan 29, 2018, 11:03:19 PM1/29/18
to
On Monday, January 29, 2018 at 12:53:12 PM UTC-8, Gerald Lester wrote:

>
> Tcl/Tk also works great with the Raspberry PI!

Are there any packages that work with tcl to program the pins on the pi?

That's why I mentioned python was well suited for that. For example, I bought a few kits for the pi (those 30 or so little boards) and all the example code was in python.

two...@gmail.com

unread,
Jan 29, 2018, 11:32:53 PM1/29/18
to
On Monday, January 29, 2018 at 4:21:31 PM UTC-8, Donal K. Fellows wrote:
> (providing they like the syntax thing, which
> is a mostly minor irritant).

If you're referring to the indentation = code thing, I find that more than just an irritant. Depending on the tab size in the editor one is using, the meaning of a program could actually change, if there's already spaces mixed in. With a tcl program (or C etc.) the indentation could be off, but the program would still run correctly.

I guess they think that they're forcing you to indent properly. Having matching {}'s help my editor to analyze the code w/o a full blown parser and can easily provide commands, such as goto a matching brace and zooming in/out.

sled...@gmail.com

unread,
Jan 30, 2018, 12:12:20 AM1/30/18
to
The answer is the question: "why use Python instead of Tcl\Tk..." Let them answer that.

Net: Python is simply another 'fast-food' language, typical of todays 'need' to learn and get something done sooner, rather than later. Forget the long term benefits of using a far richer language...

Here's one: One could with relative ease, create Python. Challenge them on the obverse.

Gerald Lester

unread,
Jan 30, 2018, 12:51:51 AM1/30/18
to
Yes, piio -- it also does twowire. It has packages for a couple of devices.

Been working with it for about a week. Works nice. I'm working on a
package for a Inertial Motion Unit.

das.sp...@gmail.com

unread,
Jan 30, 2018, 1:37:56 AM1/30/18
to
Hi cecil I am totally new to tcl. Where should i start learning ? I am mostly familiar with C++ and C.Pls help.

Gerald Lester

unread,
Jan 30, 2018, 2:00:17 AM1/30/18
to
Google Tcl/Tk Tutorial

See www.tcl.tk

Read the man/help/documentation.

In particular read and keep reading http://wiki.tcl.tk/10259?redir=41186
until you believe it.

Uwe Klein

unread,
Jan 30, 2018, 3:47:29 AM1/30/18
to
https://wiki.tcl.tk/48571
needs a little helper c prog for using interrupts.

Uwe

Cecil Westerhof

unread,
Jan 30, 2018, 4:44:05 AM1/30/18
to
I think that a good start is:
https://www.tcl.tk/man/tcl8.5/tutorial/tcltutorial.html

It is a bit difficult for me to say, because I know a lot of languages
(about twenty) and learn them fast. Do not expect the world, but if
you have problems and could use a push in the right direction: do not
hesitate to contact me by private email.

sled...@gmail.com

unread,
Jan 30, 2018, 8:32:16 AM1/30/18
to
On Monday, January 29, 2018 at 6:14:07 AM UTC-5, Cecil Westerhof wrote:
Another indicator of why they should be using tcl.

I develop speech rec\tts applications, commercially. (You want to develop domain specific bots TODAY, we have had the tools to do so for the past 8 years.) Went to AVIOS looking hoping for a quick meeting with one of Microsofts Speech\Language product managers in order to demo the product and determine if I had may head screwed on straight with regard to the best use of available technologies.

He said ten minutes at most, had two other presentations to make. Forty-five minutes later, after interacting with the bot\simulator, he stepped back and said "I know what language you used - Tcl".

Blew me away. "How could you possibly know?
His response "Cause it would be nearly impossible to do this with any language that Microsoft makes available"

So, again, you might ask those who question your judgment, "Why are you not using Tcl?".

Most likely, the answer will be "Never heard or even considered it."

Those are "programmers" with a small "p".



Robert Heller

unread,
Jan 30, 2018, 8:53:56 AM1/30/18
to
At Mon, 29 Jan 2018 20:03:15 -0800 (PST) two...@gmail.com wrote:

>
> On Monday, January 29, 2018 at 12:53:12 PM UTC-8, Gerald Lester wrote:
>
> >
> > Tcl/Tk also works great with the Raspberry PI!
>
> Are there any packages that work with tcl to program the pins on the pi?

Yes. Part of the Model Railroad System is a Tcl binding of the Wiring Pi
library (a C Library interface to the GPIO pins that provides an Arduino-line
C/C++ interface -- eg digitalWrite(), etc.). The binding just uses SWIG to
build a wrapper for the Wiring Pi C headers.

Actually, you can use the gpio command (included in the Wiring Pi library), to
"export" GPIO pins to "files" under /sys/class/gpio/ that can be just be
opened with an unpriviledged process and read (or written).

http://wiringpi.com/
https://www.deepsoft.com/home/products/modelrailroadsystem/downloadmr/
https://github.com/RobertPHeller/ModelRRSystem


>
> That's why I mentioned python was well suited for that. For example, I bought a few kits for the pi (those 30 or so little boards) and all the example code was in python.
>

--
Robert Heller -- 978-544-6933
Deepwoods Software -- Custom Software Services
http://www.deepsoft.com/ -- Linux Administration Services
hel...@deepsoft.com -- Webhosting Services

Gerald Lester

unread,
Jan 30, 2018, 10:10:56 AM1/30/18
to
On 01/29/2018 11:51 PM, Gerald Lester wrote:
> On 01/29/2018 10:03 PM, two...@gmail.com wrote:
>> On Monday, January 29, 2018 at 12:53:12 PM UTC-8, Gerald Lester wrote:
>>
>>>
>>> Tcl/Tk also works great with the Raspberry PI!
>>
>> Are there any packages that work with tcl to program the pins on the pi?
>>
>> That's why I mentioned python was well suited for that. For example, I
>> bought a few kits for the pi (those 30 or so little boards) and all
>> the example code was in python.
>>
>
> Yes, piio -- it also does twowire.  It has packages for a couple of
> devices.

See: http://chiselapp.com/user/schelte/repository/piio/home

jsunth...@gmail.com

unread,
Jan 30, 2018, 12:36:41 PM1/30/18
to
"Well python includes tcl in their official installers. If you start with python, then add twisted, and then add tcl, you can get pretty close to doing what tcl does well, but it's a lot harder that way." At that point I recommend dropping a mic, if you happen to have one handy.

Gerald Lester

unread,
Jan 30, 2018, 4:29:35 PM1/30/18
to
On 01/30/2018 09:10 AM, Gerald Lester wrote:
> On 01/29/2018 11:51 PM, Gerald Lester wrote:
>> On 01/29/2018 10:03 PM, two...@gmail.com wrote:
>>> On Monday, January 29, 2018 at 12:53:12 PM UTC-8, Gerald Lester wrote:
>>>
>>>>
>>>> Tcl/Tk also works great with the Raspberry PI!
>>>
>>> Are there any packages that work with tcl to program the pins on the pi?
>>>
>>> That's why I mentioned python was well suited for that. For example,
>>> I bought a few kits for the pi (those 30 or so little boards) and all
>>> the example code was in python.
>>>
>>
>> Yes, piio -- it also does twowire.  It has packages for a couple of
>> devices.
>
> See: http://chiselapp.com/user/schelte/repository/piio/home
>

Additionally, you can call python libs/functions from Tcl/Tk via
https://github.com/aidanhs/libtclpy

So as someone else stated -- why not use Tcl/Tk?

rhobart/popple

unread,
Jan 30, 2018, 6:39:14 PM1/30/18
to
Thank YOU!!! I was looking for this.

Cecil Westerhof

unread,
Jan 31, 2018, 6:59:06 AM1/31/18
to
For me that was one of the reasons to start using it. (Certainly not
the only one.) Often code was created with copy/pasting and
indentation was opposite to the logical situation. Nowadays we have
our IDE's to reformat code, but not in the days. Often I needed half a
day reformatting code before I could start working on it. :'-(

Cecil Westerhof

unread,
Jan 31, 2018, 9:14:06 AM1/31/18
to
Cecil Westerhof <Ce...@decebal.nl> writes:

> I started with tcl and like it. But I am asked why I use tcl instead
> of python. People find that more logical and because I can program in
> python they are flabbergasted.
>
> I am better in writing software as this kind of discussions. What
> would be good arguments to get those people of my back? ;-)

Thanks for all the replies.

One of the reasons I started using tcl is that I just wanted to learn
a new language. Also I understood it is easy to create a GUI
application and I wanted to write something to display the history of
my CPU temperature. And it was not to difficult.

Until now I did my scripting with bash, but I am going to switch to
tcl and already rewrote a lot of stuff. And even wrote a few new
scripts. People mentioned you can write programs faster in tcl and I
think I agree. ;-)

When in a group of-course you have to use an agreed on language. ;-)

One of the persons knew tcl, but because python is newer it has to be
better. Not the most logical statement I am afraid.

Uwe Klein

unread,
Feb 1, 2018, 5:56:11 AM2/1/18
to
Am 31.01.2018 um 12:45 schrieb Cecil Westerhof:
> For me that was one of the reasons to start using it. (Certainly not
> the only one.) Often code was created with copy/pasting and
> indentation was opposite to the logical situation. Nowadays we have
> our IDE's to reformat code, but not in the days. Often I needed half a
> day reformatting code before I could start working on it. :'-(
>

I nearly killed someone for doing that :-)

20 years ago I had written a rather large software package
to do distributed asynchronous data collection and instrument control.

year or two later a postgraduate was tasked to work with the system
( first thing he did was reformat my work and then effect changes
that countered the basic working principle of this system. )

So much hassle to integrate his few useful changes back into the main
tree. ...

As a secondary user of a software package it is not your task
to reformat all files just to have it your way.
That is destructive.

Uwe

Cecil Westerhof

unread,
Feb 1, 2018, 7:14:06 AM2/1/18
to
Uwe Klein <u...@klein-habertwedt.de> writes:

> Am 31.01.2018 um 12:45 schrieb Cecil Westerhof:
>> For me that was one of the reasons to start using it. (Certainly not
>> the only one.) Often code was created with copy/pasting and
>> indentation was opposite to the logical situation. Nowadays we have
>> our IDE's to reformat code, but not in the days. Often I needed half a
>> day reformatting code before I could start working on it. :'-(
>>
>
> I nearly killed someone for doing that :-)

I suppose you do not write code like:
if (something) {
something()
another()
dummy()
dummy()
stupid()
formating()
notfollowing()
without()
reformating()
}

When the first identation is correct, I would write this as:
if (something) {
something()
another()
dummy()
dummy()
stupid()
formating()
notfollowing()
without()
reformating()

Rich

unread,
Feb 1, 2018, 11:35:38 AM2/1/18
to
Cecil Westerhof <Ce...@decebal.nl> wrote:
> Uwe Klein <u...@klein-habertwedt.de> writes:
>
>> Am 31.01.2018 um 12:45 schrieb Cecil Westerhof:
>>> For me that was one of the reasons to start using it. (Certainly not
>>> the only one.) Often code was created with copy/pasting and
>>> indentation was opposite to the logical situation. Nowadays we have
>>> our IDE's to reformat code, but not in the days. Often I needed half a
>>> day reformatting code before I could start working on it. :'-(
>>>
>>
>> I nearly killed someone for doing that :-)
>
> I suppose you do not write code like:
> if (something) {
> something()
> another()
> dummy()
> dummy()
> stupid()
> formating()
> notfollowing()
> without()
> reformating()
> }

I've seen issues similar to the above occur when programmer #1 uses
tabs for indentation, but programmer #2 uses spaces for indentation (or
vice versa) and they trade edit sessions on the same file. A mess,
such as the above, occurs, esp. if several different "space"
programmers have their editors set to convert tabs to different numbers
of spaces.

Uwe Klein

unread,
Feb 1, 2018, 12:32:58 PM2/1/18
to
Am 01.02.2018 um 17:35 schrieb Rich:
> I've seen issues similar to the above occur when programmer #1 uses
> tabs for indentation, but programmer #2 uses spaces for indentation (or
> vice versa) and they trade edit sessions on the same file. A mess,
> such as the above, occurs, esp. if several different "space"
> programmers have their editors set to convert tabs to different numbers
> of spaces.
>
Where every secondary programmers first task would be
to get his tools properly set up. ( just copy the bang line for vi :-)

what the guy did was often more insidious.
like changing variable names and stuff.
also some oldstyle c to what you found on Linux at the time.
obviously more "modern".

pita to generate patches from or sometimes even understand what
he was aiming for.

Uwe

Cecil Westerhof

unread,
Feb 1, 2018, 12:59:06 PM2/1/18
to
That was not the case here. This person wrote mostly code by
copy/paste. Without taking the time to do anything about layout. You
still have the problem with tabs and spaces, but it is a lot less.

I am from the camp do not use tabs at all. ;-)

Again, it is now very easy to format code. So it is not a real problem
anymore. But in the day I liked it very much. And to be honest I still
like it.
0 new messages