For Programmers: Free Programming Magazines  


Home > Archive > Tcl > September 2005 > Tcl vs. Python









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Tcl vs. Python
Esa Heikkinen

2005-09-27, 7:58 am

Hi

This topic may have handled before, but i still ask..

What are TCL-users opinions of Python ?
What are main advantages and disavantages ?

I have used TCL many years, but i am considering to move to use more Python
instead of TCL.
But i have not made decision yet..

Of course it depends of applications also.

---
Esa



Kevin Walzer

2005-09-27, 7:58 am

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Esa Heikkinen wrote:
| Hi
|
| This topic may have handled before, but i still ask..
|
| What are TCL-users opinions of Python ?
| What are main advantages and disavantages ?
|
| I have used TCL many years, but i am considering to move to use more
Python
| instead of TCL.
| But i have not made decision yet..
|
| Of course it depends of applications also.
|
| ---
| Esa
|
|
|

I prefer Tcl to Python because of the tight integration with Tk. It
makes GUI programming must simpler. Tcl/Tk application deployment is
also elegant and simple.

With Python, though it's a good language, the sheer number of GUI
toolkit bindings drove me crazy, and nearly all were documented in terms
of C++. I wasn't interested in learning C++ to program GUI applications
in Python.

- --
Cheers,

Kevin Walzer, PhD
WordTech Software
http://www.wordtech-software.com
sw at wordtech-software.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDOTiCJmdQs+6YVcoRAn1qAJ9oUSOL5ZfE
z0/ADG2aiFZcT1lYzwCfXbvH
pD/CIyu/tWWnk9rFqif/bbo=
=e2HY
-----END PGP SIGNATURE-----
Andreas Leitgeb

2005-09-27, 7:03 pm

Kevin Walzer <sw@wordtech-software.com> wrote:
> Esa Heikkinen wrote:
>| This topic may have handled before, but i still ask..
>| What are TCL-users opinions of Python ?
>| What are main advantages and disavantages ?
> I prefer Tcl to Python because of the tight integration with Tk.
> ...


I had a look at Python once, and I disliked on python that
it didn't have a "for"-style loop. That is one, where you
specify an <init, condition, incr>-triple. Pythoners
answered that there is "while", which would be equivalent,
but it isn't: the big difference is the execution of the
"incr"-part, upon "continue".

The other thing is, that in python one cannot make
one-liners for some trivial things, as a newline is
just plain syntactically necessary on some places.
In my eyes, certain one-liners could have been possible
and consistent with pythons philosophy, such as
e.g. a nested "if" in a "while": "while ...: if ...: do_sthg"
or generally, nesting of "one-part" syntactical structures.

PS: I won't argue against the indentation-thing in python. It's kinda .
Eric Brunel

2005-09-27, 7:03 pm

On Tue, 27 Sep 2005 08:18:11 -0400, Kevin Walzer <sw@wordtech-software.com> wrote:
[snip]
> With Python, though it's a good language, the sheer number of GUI
> toolkit bindings drove me crazy, and nearly all were documented in terms
> of C++. I wasn't interested in learning C++ to program GUI applications
> in Python.


Errr, if you're used to tcl/tk, maybe you could just stick to Tkinter? Since it's basically just a matter of writing "Command(option=value)" instead of "command -option value", I don't see how it can drive you *that* crazy... And for a change, the documen
tation is much more in terms of tcl than of C++ ;-)

As for the OP's question, I think it's just a matter of taste: I personally prefer Python because it fits my brain. Other may prefer tcl for the same reason. Both languages have their strengths and weaknesses, so just choose whichever you like the most or
the most practical for what you want to do...
--
python -c "print ''.join([chr(154 - ord(c)) for c in 'U(17zX(%,5.zmz5(17;8(%,5.Z65'*9--56l7+-'])"
bgeer

2005-09-27, 7:03 pm

"Esa Heikkinen" <esa.heikkinen@insta.fi> writes:
>I have used TCL many years, but i am considering to move to use more Python
>instead of TCL.


Learning new stuff is always stimulating.

OTOH, I particularly dislike python's indentation defined blocks - I
have a hard enough time getting Makefile tabs/spaces in the right
place. Don't need the additional aggravation that using python might
generate. So I chose to learn tcl/tk instead of python.

The linux distribution [various versions of Redhat] I have available
at work include tk with tcl, but not tk with perl nor Tkintr python.
To get tk installed for perl &/or python would require "pushing a very
long chain" [i.e., big fight with symin] therefore I learned tcl/tk
so I could build gui startup scripts for horrid vendor programs. I
even have tcl/tk gui's for starting perl scripts.

--
<> Robert Geer & Donna Tomky | |||| We sure |||| <>
<> bgeer@xmission.com | == == find it == == <>
<> dtomky@xmission.com | == == enchanting == == <>
<> Albuquerque, NM USA | |||| here! |||| <>
Kristoffer Lawson

2005-09-27, 7:03 pm

Esa Heikkinen <esa.heikkinen@insta.fi> wrote:
> Hi
>
> This topic may have handled before, but i still ask..
>
> What are TCL-users opinions of Python ?
> What are main advantages and disavantages ?


Well nothing, except Lisp, matches Tcl for syntactical simplicity and
cohesion. Everything fits the same model. I have a huge appreciation for
solutions like that as it gives you a lot of power but also keep the core
simple.

It is also somewhat easier to do meta-programming in Tcl as you don't have
to care about indentation of code

Python apparently lacks a stub model at the moment. So extensions depend
quite strictly on a particular version of the core. Not so with Tcl.

How is Python's unicode support? How easy is it to extend with C?

It may or may not matter but Python is younger. Tcl has reached a very high
level of maturity and is extremely stable (not always true for the
extensions).

The whole extendibility aspect in Tcl is also really unmatches elsewhere.
You can extend the language with new paradigms and they actually fit in
neatly. In that sense it is future proof.

Python's advantage at the moment is that it has got a lot of good press so
people are actively developing a lot of things round it. It's hot, for the
moment. Whether this eventually fades away, who knows. For most things this
won't matter as Tcl supports a lot of technologies, but it may matter for
some areas. It also comes with a large library included whereas some Tcl
installations are pretty bare.

I am a Tcl user myself so obviously biased :-) I guess you need to answer
the question, why are you considering the switch? Is there something you are
unhappy with in Tcl? Or are you switching just for the hype around Python?
If it's the latter, then maybe it's not worth the effort. If it's the
former, perhaps the concerns can be answered here, or maybe they are real
show-stoppers.

--
/ http://www.fishpool.com/~setok/
Darren New

2005-09-27, 7:03 pm

Kristoffer Lawson wrote:
> Well nothing, except Lisp, matches Tcl for syntactical simplicity and
> cohesion.


FORTH. :-)

--
Darren New / San Diego, CA, USA (PST)
"Rabbit beer, now with organic hops!"
Jingzhao Ou

2005-09-27, 7:03 pm

I used to be a big Python fan. Now I have moved to Tcl and only Tcl. I
like the syntax of Tcl, especially when used with Tk.

Tcl is small and efficient. It can be easily ported to many new
platforms. The C interface is very clear. Most importantly, it is more
like a shell than Python.

My only complain about Tcl is its weak (and kind of awkward) support of
numerical and array processing. For this issue, Python is doing much
better than Tcl. However, Tcl is very flexible and should be able to
address this weakness in the future. I am now very interested in the
BLT package. I believe that BLT is a very promissing solution to this
weakness. BLT is awesome! I have never seen any software program that
offers better graphical plotting support than BLT! I really hope that
some more people can contribute to make it better and better.

Happy Tcl'ing!

Best regards,
Jingzhao

Esa Heikkinen

2005-09-27, 7:03 pm


I have liked TCL quite much mainly because of simplicity. But there are
maybe few "drawbacks":
1) It is little difficult to build complicated data structures or even
databases
2) restricted to build big programs ?


And if we are comparing Python and TCL, i am also interested about:

1) Code-size. If we are making same task with TCL and Python, which is
smaller or bigger.

2) Code-clarity and -maintenance (for example how easy to do complicated
spaghetti code)

3) Easiness to find bugs

4) Most common mistakes in code

5) Testing properties

6) Code-speed



---
Esa
Jeff Godfrey

2005-09-27, 7:03 pm


"Esa Heikkinen" <esa.heikkinen@tut.fi> wrote in message
news:dhc90n$oql$1@phys-news1.kolumbus.fi...
>
> I have liked TCL quite much mainly because of simplicity. But there are
> maybe few "drawbacks":


> 2) Code-clarity and -maintenance (for example how easy to do complicated
> spaghetti code)


You can write FORTRAN in *any* language... ;^)

Jeff


Ian Bell

2005-09-27, 7:03 pm

Jeff Godfrey wrote:

>
> You can write FORTRAN in *any* language... ;^)
>


You can write CRAP in *any* language too. What was your point?

Ian

Bryan Oakley

2005-09-27, 7:03 pm

Ian Bell wrote:
> Jeff Godfrey wrote:
>
>
>
>
> You can write CRAP in *any* language too. What was your point?


Apparently you're not old enough to recognize the above referenced
truism. I'm not sure where the definitive version is (I bet Cameron
might know...), but here's one link:

http://www.pbm.com/~lindahl/real.programmers.html

You have to scroll down a bit to find this quote:

"Besides, the determined Real Programmer can write Fortran programs in
any language."

The article is required reading. There will be a test later.
Donal K. Fellows

2005-09-27, 7:03 pm

Jingzhao Ou wrote:
> My only complain about Tcl is its weak (and kind of awkward) support of
> numerical and array processing. For this issue, Python is doing much
> better than Tcl. However, Tcl is very flexible and should be able to
> address this weakness in the future.


Depending on the details of what you're doing (of course) you might find
the NAP extension useful for this sort of thing.

Donal.
Arjen Markus

2005-09-28, 3:59 am

And I hope that the math module in Tcllib provides some of the support
that
you are looking for too, in pure Tcl.

NAP can be found at: http://nap.sourceforge.net (or on the Wiki of
course)

Regards,

Arjen

Ian Bell

2005-09-28, 8:07 am

Bryan Oakley wrote:

> Ian Bell wrote:
>
> Apparently you're not old enough to recognize the above referenced
> truism. I'm not sure where the definitive version is (I bet Cameron
> might know...), but here's one link:
>
> http://www.pbm.com/~lindahl/real.programmers.html
>
> You have to scroll down a bit to find this quote:
>
> "Besides, the determined Real Programmer can write Fortran programs in
> any language."
>
> The article is required reading. There will be a test later.


I am definitely old enough but rarely get involved with HLLs (except
tcl/tk). I guess I fall squarely into the category of:

'If you can't do it in Fortran, do it in assembly language. If you can't do
it in assembly language, it isn't worth doing.'

Ian

ecky-l@web.de

2005-09-28, 8:07 am


Arjen Markus schrieb:

> NAP can be found at: http://nap.sourceforge.net (or on the Wiki of
> course)


Uii, "Nap: Linux Napster Client" :-)

The right URL is http://tcl-nap.sourceforge.net/

Regarding the numerics - yes, that is a drawback I encountered too...
Maybe something like BLAS or LAPACK could be interfaced to Tcl (with
swig)? That would be great and I think not too complicated.

Math in Tcl is not the same as numerical processing in C. Currently I
use to retype code from the "Numerical recipes in C" book and interface
this with Tcl to get the numerical processing done that I need. Because
of the NR license, this can't be distributed to the public as source.


Eckhard

Cameron Laird

2005-09-28, 7:01 pm

In article <opsxrl76rlrqur0o@eb.pragmadev>,
Eric Brunel <eric_brunel@despammed.com> wrote:
Cameron Laird

2005-09-28, 7:01 pm

In article <433973db$0$29708$9b536df3@news.fv.fi>,
Kristoffer Lawson <setok@fishpool.com> wrote:
Cameron Laird

2005-09-28, 9:57 pm

In article <433aaabd$0$3622$9b536df3@news.fv.fi>,
Kristoffer Lawson <setok@fishpool.com> wrote:
Robert

2005-09-28, 9:57 pm

I have nothing but good things to say about DBD::Oracle as I use Perl +
DBI + Oracle every day.

I keep plugging away with Tcl because I like the language and I like
the people involved.

Robert

Isaac Gouy

2005-09-28, 9:57 pm

David N. Welton wrote:
> Eckhard Lehmann wrote:
>
>
> My experience doesn't really agree with you, and I would guess that Tcl
> will always be a little bit slower because it is so dynamic. Here are a
> few benchmarks:
>
> http://shootout.alioth.debian.org/b...cl&sort=fullcpu
>
> Tcl ends up being slower, but not that much, and Python looks like it's
> more memory hungry.
>
> --
> David N. Welton
> - http://www.dedasys.com/davidw/
>
> Linux, Open Source Consulting
> - http://www.dedasys.com/



http://shootout.alioth.debian.org/b...cl&sort=fullcpu

As y'all can see there are several failing Tcl programs shown on The
Computer Language Shootout, and a few new tests.

Please contribute fixed programs if you can, thanks Isaac
http://shootout.alioth.debian.org/f...lcpu#contribute

Friedrich Dominicus

2005-09-29, 3:57 am

"Isaac Gouy" <igouy@yahoo.com> writes:

>
> As y'all can see there are several failing Tcl programs shown on The
> Computer Language Shootout, and a few new tests.

The errors suggest a messed up system.

If you use tcl/tk you should be able to figure out what the correct !#
line is


>
> Please contribute fixed programs if you can, thanks Isaac
> http://shootout.alioth.debian.org/f...lcpu#contribute

the programs are find just the path to the interpreter is wrong.

Friedrich

--
Please remove just-for-news- to reply via e-mail.
ecky-l@web.de

2005-09-29, 3:57 am

Actually, *using* DBD::Oracle is fine - if you are on Unix.

But if you are not (and unfortunately I am not), then Perl altogether
gets a pain, including DBD::Oracle.


Eckhard

suchenwi

2005-09-29, 7:57 am

A simple and portable shebang line (tested on Solaris, Linux, Cygwin)
is

#!/usr/bin/env tclsh

Donal K. Fellows

2005-09-29, 7:57 am

Esa Heikkinen wrote:
> I also think i have to update my knowledge of TCL.
> Could you recommend some good general books about TCL with last knowledge ?
>
> Of cource, i can read also from the net, but i prefer read books..


At the moment, the latest Brent Welch is probably the best bet.
http://www.beedub.com/book/
That edition is even not quite as heavy as some of the previous ones. :)

Remember that you're always welcome to ask questions on comp.lang.tcl;
we love to help newcomers and old hands alike.

Donal.
Andreas Leitgeb

2005-09-29, 7:57 am

suchenwi <richard.suchenwirth-bauersachs@siemens.com> wrote:
> A simple and portable shebang line (tested on Solaris, Linux, Cygwin)
> is
> #!/usr/bin/env tclsh


that's also my personal favourite :-)
Robert

2005-09-29, 7:57 am


eck...@web.de wrote:
> Actually, *using* DBD::Oracle is fine - if you are on Unix.
>
> But if you are not (and unfortunately I am not), then Perl altogether
> gets a pain, including DBD::Oracle.
>
>
> Eckhard


I would have to differ. I am on Windows XP and I have had no problems
with DBD::Oracle or Perl at all. If you roll your own Perl that might
be the case but I use ActiveStates Perl on Windows and have excellent
results.

Robert

Kristoffer Lawson

2005-09-29, 7:01 pm

Cameron Laird <claird@lairds.us> wrote:
> In article <433aaabd$0$3622$9b536df3@news.fv.fi>,
> Kristoffer Lawson <setok@fishpool.com> wrote:
> .
> .
> .
> .
> .
> .
> I think Tcl programmers code errors more often and more predictably.
> In very crude terms, Tcl emphasizes simplicity and regularity, even
> in cases where many programmers have trouble thinking simply, while
> Python puts surprise-avoidance at the top of its list of design
> criteria.


Actually, this is true. I've seen some really cryptic errors in Perl at
least. Tcl's error-handling is pretty straightforward.

--
/ http://www.fishpool.com/~setok/
Isaac Gouy

2005-09-29, 7:01 pm

> The errors suggest a messed up system.
> If you use tcl/tk you should be able to figure out what the correct !#
> line is


And the same !# line appears in 16 programs but only 7 have a problem.

(My current assumption is that Brent fixed something which allowed 9
programs to be measured and then the measurement run was interupted.)


[color=darkred]
> the programs are find just the path to the interpreter is wrong.


There are also some problems without Tcl implementations :-)

bgeer

2005-09-29, 7:01 pm

"Robert" <sigzero@gmail.com> writes:


>I have found the book (Practical Programming in Tcl and Tk) by Brent
>Welch et al. is about what I need to understand things. This newsgroup
>and the wiki give me enlightenment though.



Better yet, just start with the /usr/share/tk8.3/demos/widget file.

Yes, book's are good, but when you've worked for cheap-ass companies
who won't buy books for developers, you learn how to get things done
any way ya can.

If the python distribution had as nice a demo, I might be using it.

--
<> Robert Geer & Donna Tomky | |||| We sure |||| <>
<> bgeer@xmission.com | == == find it == == <>
<> dtomky@xmission.com | == == enchanting == == <>
<> Albuquerque, NM USA | |||| here! |||| <>
Robert

2005-09-29, 7:01 pm

He did ask for a book as that is his preferred way of learning...

Robert

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com