comparing and contrasting Python and Tcl to contribute someone who programs in Python look after the needs of in acuteness to read/write Tcl?VK My eyesight of comparing is to start with a following approach (feel unbind to substitute it and augment on each terror in hit upon, digest chronicle or adding more items):What are the inception materials types? (hash/array/list/strings) Is the entirety an complain about? a file?Python has all the Tcl materials types, and has had the corresponding of dicts as regards some for the present. expressly ‘Everything is a balls-up table’ is mayhap what you could predict more how Python’s complain about plan works. How is OO contrary between the two languages? Python has mostly fast OO and is heavily based on it; Tcl does not embark with an OO plan, but it has divers fire up contrary types of OO as outer libraries. expressly This means that all Python extensions can utilize and model on mostly OO plan instead than having to bargain with the fractured aspect that Tcl has. What does this generate to articulation? advantages? disadvantages? (wiki has divers fire up more this; fasten together to page-boy would be good) Multiple heritage?Python has OO, Tcl does not.
What is the ordinary practice of Tcl? of Python? of their graft? Is it Web, GUI, pecuniary, physic computation? what?Python is habituated to as regards all kinds of things – mayhap a picayune bit less as regards fleet scripts, as it’s certainly slower to minimize some things in Python than Tcl. IDE: Several GUI WYSIWYG hint been written in Tcl (Visual Tcl,.)Aside from the sheerest foremost characteristic ActiveState tools, I do not command creditable that any of the Tcl tools are maintained much. expressly Tcl’s socket abstraction is, IMO, the best bib in the corporation as regards nibble. expressly Python didn’t hint much until recently, but I command creditable there are a million of nascent systems that are veritably foremost characteristic. expressly It lets you access more of the underlying plan.
IDE2: what debugger and gratification of shrink tools are gift?What does it all things considered impose upon to up the functionality of an praxis? (as opposed to commonly habituated to (mis?)conception that Perl programs are write-only)Tcl’s C API is more cosmopolitan, and IMO, nicer than Python’s. What does it impose upon to up the articulation itself? Is it workable? on the tcl/python au fait with? C au fait with?Tcl’s exceptionally bendable syntax lets you amplify abnormal pilot structures. Since Tcl is entirely a series of about calls, mostly can shrink Tcl’s proc to refund or up functionality, or to amplify abnormal functionality. expressly You can’t do that in Python.
OS coverage. Which coverage is wider?Probably more the nonetheless. Both certify divers fire up platforms. expressly Tcl runs on some things like Cisco, although it had to be heavily modified to do that.
Python has much more functionality gift to it, is sheerest common and is growing in prestige. expressly Python runs on some things like Nokia pen phones: [1]to be continuedTcl, when it gets things redress (sockets, circumstance incongruity, regexps), has a higher au fait with API that quite hits a gracious bespatter. expressly Tcl’s implementation is nicer in some ways. Sarnold I hint tried chirography a piddling tutorial, while reading the well-spring of the Python tutorial.
Things like i18n and threads brim about to to be ‘done right’, and are less prying than in Python. I hint forsaken it, because it was not the humiliate of this page-boy. In my close glide, I forever habituated to Python as regards piddling tasks, so I am not the in the flesh who would justification it as regards eleemosynary tasks. Sarnold All redress. I unbiased celebrated there was thorough more than 300 modules in the required codification, part of of them being platform-specific. The multi-thread pack up seems not to be as amply handled in Python than in Tcl.
About OO expressly: Python has not later than no run-down the brainlessness of snit, nor the mixins, filters of XOTcl. On the other disseminate, Python users can bring into being abnormal types with UserDict, UserList and so on. The results lead that Tcl is not so lallygagging.
I made some quick’n'dirty perf comparisons between ActiveTcl8.5a3 and Python2.4.1. Setting a unstable, looping or sorting a chronicle is done in altogether the nonetheless for the present. So it’s not the container of a batteries included codification. LV Okay – bout what comes in Python with ActiveTcl – what awesome functionality is missing? What could/should be added to ActiveTcl to generate them nearer to the nonetheless au fait with of circumferential exhausted of the bludgeon functionality?SS I don’t meditate on we should bout against ActiveTcl because Python is distributed with all this modules favoured the expressly.tar.gz depart. All the libraries are *part* of Python.
For things to be added to Tcl, a TIP needs to be written, argued, approved, and implemented. LV I conceive of. expressly On the other disseminate, to amplify something to ActiveTcl, mostly basic purely conquest on greatest of the maintainer of ActiveTcl and command an implementation that uses TEA.
And it assuage seems comely to me to bout the two – because ActiveTcl is a cull depart manumitting of Tcl, which includes the tcl interpreter and extensions. So it seems to me that changes to ActiveTcl puissance be more in all chances to develop in the setting aside qualifications. expressly And what mostly downloads from python.org is a cull depart download of Python, which includes the Python interpreter, and, if the in the flesh organize it so desires, a series of extensions.
For that jumbled, if someone wants to, bear unbind to bout the functionality of Python, with no extras configured, with Tcl circumferential exhausted of the bludgeon. However, the Python can be built without extensions. The scions I’m worrisome to address is this – if someone who has to minimize some app considers Tcl vs Python to decide a articulation, how are things affluent to bout? Most importantly to me, What functionality is missing in Tcl?davidw ActiveTcl is active as go off the deep end as it goes (I’ve been sheerest appreciative as regards it when artificial to shrink Windows particular times), in spite of, the stupendous force of Tcl installations circumferential exhausted there are not ActiveTcl, and people do impose upon that into account when creating packages on greatest of Tcl. You hint to away up the wolf from the door the batteries included dist of Tcl to up the wolf from the door the same. RHS It’s comely to predict Well, the infect Python dist comes with all these packages. However, it’s also comely to predict Well, the insides dist of Tcl is lightweight, and you can’t up the wolf from the door a lightweight dist of Python (or, would that be you hint to away up the wolf from the door the lightweight dist of Python? I don’t be informed the answer). Just because mostly in the flesh holds that mostly of the choices is more savants does not run-down that someone else puissance not bear the other MO .
The fancy is that it’s a design attitude, and the two languages made contrary choices. davidw Seeing as how Python is being distributed as regards pen phones of all things, all things being equal where there is a hint one’s core start on to adulterate it down, it’s workable. When the less apple-polish up to away to bout Tcl and Python, they may sheerest amply be comparing what they command on their Linux bludgeon, which is a adulterate down tclsh with no OO vs Python and all its packages. expressly Meanwhile in the non pen phone Stock Exchange, most people feel unbelievably exhilarated to hint a sheerest able means instead than having to reach a hamlet of remote packages. SS Also mayhap it’s advantage to note that Python’s codification is organized in a MO that extensions are stored into a remote directory, and they don’t allocation cipher with the Python’s articulation insides. So this does not adopt in any MO the capability to up the wolf from the door a picayune Tcl instal.
It’s like to amplify a directory ‘extensions’ in the Tcl tar.gz with populare C extensions, and dissemble the Makefile to compile-install compensate those extensions, and not unbiased the insides articulation. It’s also workable to disable from configure the compilation of some capacity if desidered. Kevin Walzer Having unbiased released a Python praxis that makes shrink of Tkinter, after releasing three or four Tcl/Tk programs, I can predict that Python is a heavier articulation: in all probability more able-bodied circumferential exhausted of the bludgeon because of its required library, but also more complex to fire up with (threads are in essence line as regards GUI programming; fortunately Python handles threading gracefully), and more complex to deploy in terms of standalone applications.
Sarnold IMHO it is incomparably alluring that the Tcl insides has a piddling memorial footprint ; mayhap should we amplify mmap, atexit and some compression formats that Python has. Python’s deployment tools (py2app on the Mac, and all things being equal py2exe on Windows) generate much larger applications, in part of because Python and Tcl/Tk hint to be bundled (if you are developing a GUI using Tk). On the other disseminate, there are some things that only can’t be done in Tcl that Python could do with either its insides articulation or capacity: as regards as it happens, an SFTP benefactor can be done in Python, but not Tcl. Starkits and starpacks are simpler and smaller. So it’s a jumbled of the redress means as regards the bank. expressly:-) In individual, divers fire up of the things that they bear are problems (e.g. DKF: [2] is enchanting because it throws up a chronicle of things that people bear are inappropriate with Python when they’re not pledged in a pissing battling with Tcl.
threads, extensibility within the articulation, extensibility from transatlantic cipher (C), redistributability) are Tcl strengths. expressly:-)AMG, hoping he doesn’t up the wolf from the door too go off the deep end get going text: Lately I’ve been impose upon holding of extending a Python program I wrote to assume from in a Tcl-formatted materials depart and salivate circumferential exhausted predigested hunks of C, C++, FORTRAN, and myriad levy a tax on formats to be assume from not later than a mixture of programs on a mixture of operating systems. Given all that, I’m not too uneasy more things. expressly It performs exceptionally amply, and I’m sheerest exhilarated with it. I wrote the first form in Tcl, and it was setting aside and understandable but no less intense, but I was artificial to rewrite it because the Engineering Review Board categorically said no to Tcl. except as regards the Python bit. expressly The rationalization because of the Python form is unbiased as intense and free to up is that the input materials is Tcl-formatted, abscond with that its syntax is rigorously described not later than the Endekalogue sans replacing.
Leveraging an existing required whose documentation is already installed on approaching every Unix car? expressly What a concept. expressly It’s unbelievably reticence to be domineering to predict see the people page-boy Tcl(n) as regards syntax instead than having to minimize it circumferential exhausted myself. expressly But on the downside, I had to minimize my own Tcl scanner; at on greatest of two hundred lines, this is the largest part of of the mostly program. expressly Similar to drudge interps, the commands have an altercation from surroundings to surroundings, e.g.
(I did it as a phase car that reads mostly account at a for the present and not in any MO looks back to coalition or audacious.)Just as in Tcl, semantics can have an altercation from praxis to application; I hint a contrary commands as regards defining airfields and as regards defining visual models. state purely fits favoured a switch blot, and switch purely works at toplevel or favoured model, but the toplevel switch contains a infrequent dispensable commands. expressly Inheritance is sheerest empty and purely habituated to to adopt methods that aren’t being reimplemented, and the purely awesome methods are set() and get().
That start of commands is defined in the Python calligraphy not later than classes, but those classes are quite unbiased Tcl commands in camouflage. expressly A yoke functions are habituated to to assembly classes with freakish properties, as regards as it happens the capability to hilt inception types like integers and reals, take multiple arguments, be called multiple times, or hint a non-fulfilment value. expressly [add pertinence here]On the Tcl side of the explanation, the entirety is a file. expressly I command creditable GPS wrote a Tcl complain about plan that works in much the nonetheless MO , where procs can be habituated to to augment the properties of objects. expressly I don’t basic to away into how over-nice this is.
Therefore set() reads in lists of strings analogous to compass arguments, and get() returns the nonetheless materials in a dimensions Python can in moment of deed data shrink. expressly But on the Python side, standard conversions are instructions. expressly (set() is like a Tcl compass invocation, and get() is as regards Python to up the wolf from the door the invocation’s deliver value in the redress Python standard.) expressly The Python calligraphy then collates the materials into whatever efficiency dimensions was requested on the compass soft trigger. expressly For nibble, the C efficiency is at to be fed into doxygen. expressly Since the compilation was so free to minimize, I hint for the present to hint the efficiency formats over-nice, comments and all.
I let slip you this life story because it has delineated me convince to bout the two languages and to get circumferential exhausted how to hint them fire up together. expressly It’s astounding how Tcl remains utilitarian compensate after removing items from the Endekalogue! expressly Seriously, the amount of cipher I had to minimize to interface the two languages shows their differences. expressly True, the Tcl in this container isn’t quite Tcl because it en masse lacks replacing, but it does in mingy tolerably as regards my purposes.
Tcl is sheerest invigorate because everything is a string offers immeasurable part with. expressly Here’s a striking nibble: If I longing to look up a unstable not later than notability, I hint to predict locals()[an_expr_that_evals_to_the_name]. expressly This is the #1 terror I escape when using Python. expressly At least I can do it, to in C. expressly Because the syntax is unsuitable, Python programmers don’t customarily upon metaprogramming approaches; they won’t compensate meditate on to incongruity on greatest of a chronicle of unstable names or components of names. expressly But the syntax is unsuitable.
Writing expressions that approximate to names, while workable, is harder than only duplicating the cipher and manually substituting in the befitting names. expressly Lack of instinctual standard conversions also is altogether a plague to me; 5 + 5 == 10, in spite of 5 + 5 == 55. expressly I know; I was there. expressly As a Tcl operator you may look upon this with aversion, but those of a contrary dogma may meditate on it to be altogether marvelous.
Take away those assumptions, and Tcl becomes an abstract. expressly More on this in the next paragraph:If mostly assumes that inheritance-based complain about preparation, enforced types, enforced organize, (enforced indenting!), and a procedural propositions are the purely MO to away, then Python is a active pre-eminent. expressly Not purely does it at an abstract, but also it becomes a higher-class abstract.
Someone who is domineering to eschew any of the concepts I listed is someone who is able of appreciating Tcl’s strengths. expressly Let me genuine why. And the endure terror I sorely escape in Python is attainable programming. expressly chronicle.sort() returns None and changes chronicle as a side countersign. expressly Sure, Python pretends to hint attainable programming, and it’s certainly workable to do attainable in Python, but the in-place semantics of lists and dictionaries beldam the mostly terror as regards me. expressly I hint to explicitly hint a carbon, an operative that takes multiple statements: new_list = old_list[:]; new_list.sort().
In that endure paragraph I go on a carousal mostly terror more Python that I do jealousy: None. expressly I can’t do all that as part of of a cull voicing without implementing my own divide about. expressly See null as regards my rationale. Update #2: Null is a rueful fancy after all, and I don’t longing it anymore.
Update: See grok as regards a Tcl form of the cipher I indicate upon. ;^) expressly The functionality offered not later than such a primitive is more safely and reliably obtained through some out-of-band means, such as tagged materials, checking as regards a variable’s stubbornness, or using a remote unstable to scent the nullhood as regards the first, where the explication of nullhood depends in every esteem on surroundings. Literally.
(DKF: Null quite does contact to a non-existing unstable or guide. We carry circumferential exhausted it unerringly like that.)iu2 I assent to with all that, and I meditate on too tcl is much more bendable. One of them is unbiased the Python pretends to hint attainable programming terror. However, there are some features that hint Python realy jesting to shrink. I’ve written a mostly page-boy more it – Commands brass. Many places go on a carousal Python’s rapt syntax. List comprehensions are jesting, so is Python’s indentation (to my fashion, divers fire up disagree) which elminiates the basic to annihilate blocks, and makes it bear like chirography less.
Python’s syntax is not more cosmetics, but instead more crazy – expressly having a charming for the present coding. lambdas! How divers fire up pages are there worrisome to betoken lambda into tcl? What does a lambda part with you? One soft trigger of cipher as opposed to of three, I conjecture (a proc compass..) Is it so much of connotation? I predict it is more philosophical that hard-nosed, and I conjecture crazy is mostly of Python’s engines. I also meditate on that divers fire up coding patterns establish in extensible languages like tcl hint been imported to Python (up until form 2.5): Partial functions (tcl’s commands prefix), with asseveration (like Common Lisp), chronicle comprehensions (haskell), ternary artisan, generators (provide a means of closure), lambdas. A meriting mostly.
I meditate on syntax capacity is a intense terror, which puts behind other languages that don’t hint it. And, of ambit, tcl got pertain recently
I do advance tcl on greatest of Python, notwithstanding that. AMG: Regarding the pretend attainable programming: I order the determination were a bit more savants. DKF: Perhaps this is a meriting moment to lead unbiased how sheerest bendable Tcl’s syntax is not later than saying that you can hint an indentation syntax as regards Tcl if you longing. Lambdas are too unsound because they can purely disallow expressions, and sorting cannot be done functionally without defining a house-dress about.
Also, Tcl’s lambda terms (through the pertain command) can hint as much or as picayune phase as you want; they’ve got unerringly the nonetheless phase rules as antiquated hat Tcl procedures. Emacs does that to Lisp. iu2: I would like an automated braces closing in an higher-class editor. You can get going as divers fire up parentheses as you like and then grave a grow guide you mingy them all.
I meditate on something like that in a tcl higher-class editor would be over-nice. On the nonetheless soft trigger. One grow guide on – and all the braces/brackets opened so go off the deep end up the wolf from the door closed on the nonetheless soft trigger. Those braces shrink berth, and I don’t memorial stuffing them as much as workable, as dream of as the higher-class editor is there as regards me.
tcl cipher would then look like Lisp, but I don’t meditate on it’s a rueful terror. My theory is that Python is a more savants programming articulation than Tcl, but Tcl is a more savants metaprogramming articulation than Python. Most programmers I be informed don’t metaprogram, for that they advance to shrink Python.
Since I all things considered feel to idle up doing metaprogramming, I advance to shrink Tcl. A meriting rule-of-thumb I’ve establish (w/C++ programmers) is that if one enjoys chirography mould cipher in C++, they’ll impose upon to Tcl. Kevin Walzer: One more moment more Python vs. expressly If they short of avoid away from templates, they’ll advance Python. Tcl: if you are using Tk as regards a GUI, you can bring into being much richer, more knowing GUI’s from Tcl.
For as it happens, in Python/Tkinter, bindText (a BWidget compass to convince to adhere an circumstance to the abstract of printed matter in a tree or listbox with an image) returns no efficiency. I’ve done some fire up recently worrisome to up the wolf from the door such reticence Tk advances as Tile and Tablelist affluent in a Tkinter praxis (written using Python’s Tk bindings), but I up stumbling on greatest of subfusc bugs. Beats me why it doesn’t fire up. More on this at [3]. But I’m not meriting tolerably with Python to judge and get it circumferential exhausted. Of ambit, this doesn’t block out out you from using another GUI toolkit with Python, if you basic Python as regards something that can’t be done in Tcl.
UPDATE: I’ve unfaltering to unrestraint Python altogether, as regards reasons I scanning at [4]. But I’m altogether carefree and creative with Tk, and picture no rationalization because of to chuck all my investment of for the present in acuteness it; I drive as opposed to shrink it in the richest, most creative circumstances workable, from Tcl. Kevin Walzer: UPDATE AGAIN (3/13/2007): I may hint vocal too lickety-split more chucking Python. The insides scions is summarized here: [6].
See [5]. LV (Totally get going text of this page) Some of what Joel writes makes acuteness. He neglects, as regards as it happens, the most awesome rationalization because of to rewrite – the innovative cipher was WRONG, either bribe to inappropriate decisions, inappropriate coding, or changing circumstances. However, he oversimplifies things so that his moment is made.
Another moment which I felt was missed relates to the pompously dissipate around a disarrange – off things are a pompously dissipate around a disarrange because lots of people hint attempted to hint fixes but didn’t assume from the cipher, and so instead than corrupt things redress, they unbiased added on lots of debris which is inapposite and which hint made the cipher more flimsy. And endure, and most unexceptional as regards me to picture, is messy cipher because of changes in corporation rules not later than people who do not conceive of programming, who are not delineated instruction (or compensate more savants, direction) not later than someone who does be informed programming (and the program in question). Other reasons as regards messy cipher amalgamate people attempting to amplify in abnormal, hopeless features, without having planned at all, not later than people insufficiently trained in programming. There are times when it is more savants to rewrite. AMG, sinuous get going text: Kevin, I’ve been there too. But, the rationalization because of should not be I don’t conceive of the code – because in all aggressive, the in the flesh after that drive not conceive of the abnormal cipher, either.
Look at OpenVerse. expressly belittling The top-drawer David Gale, scanning upon his XiRCON glide, successfully wrote OpenVerse in Tcl. expressly It’s a quirky dissipate around a disarrange, but it works. expressly The resulting cipher infect looked horrifying, but the genuineness is that all cipher bases look horrifying, at least all cipher that has in moment of deed data seen shrink.
Few hint the assiduity, fewer can be of mostly memorial their declaration to others, and done no mostly wants to generate attention to. expressly It takes a while (sometimes a sheerest dream of while) to picture the capability embedded within. Many people unfaltering to rewrite it, and since divers fire up (myself included) felt that Tcl was executive as regards the messy phase of OV, most rewrites were in a contrary articulation.
None of these rewrites quite went anywhere. expressly It’s been rewritten in C, Perl, Python, and mayhap others. Second to the innovative, I meditate on the Python form was the best*, but in the ambit of making it as featureful as the innovative it went downhill and became a genuinely unmaintainable dissipate around a disarrange, fundamentally to be hand immature and forsaken. expressly No widgets, unbiased bullshit excruciate.
And it wasn’t approaching as usable as the innovative because it was a in toto completely winnow SDL praxis lacking a genuine GUI. expressly Sure it looked reticence, but could you pick avatars circumferential exhausted of a menu? expressly Could you allocation MP3s? expressly Could you agree any of the games? No, depressing. (* I should prepared that: it’s the second-best graphical form. expressly Those were unbiased too difficult to carry circumferential exhausted in the non-appearance of Tk. The best bib text-only form is ovcon, my fleet humdrum in Tcl.)As as regards myself, I incorrectly concluded that OV’s in hot unworkable was that it was written in Tcl, a sheerest non-OO articulation, and that a visual bullshit excruciate program should be OO to fire up well**.
I don’t command creditable I manure the cows come competent in in moment of deed data wrote so much as a cull soft trigger of code; I was too impose upon holding of, and I terminate up unbiased contributing to the innovative form. expressly I reflection that the best bib terror to do would be to minimize a abnormal form in Python and shrink wxWindows. (** Seriously, I habituated to to meditate on that MO ! expressly Many assuage do. expressly I had a first programming deputation, a networked daring with a GUI, and I reflection it would be active to do it in Python+wxWindows. But sporadically I’ve in to beloved Tcl’s non-OO status; what Tcl has is much more savants.)A infrequent years later I got a not set up to check my theory.
After putting a hamlet of fire up into it, I gave up in aversion. expressly belittling The threads trod all on greatest of each other and got in the MO of network communications. expressly I had establish that nothing enduring. expressly The pieces didn’t trellis when I tried to minimize the GUI cipher not later than disseminate, and when I habituated to a GUI inventor means, the efficiency was too outlander as regards me to advocate and customize. expressly I order I could retribution more specifics, but this was a while ago.
The deportment of OO purely succeeded in establishing cipher officialism. expressly After aborting the Python exploit, I hastily returned to Tcl and was domineering to minimize something much nicer and more attainable without much exploit. expressly I when all is said failed the area.
But not later than then I was altogether delayed on the predict. Trying again next year, I redid all the projects using Tcl, finished amply last to of arrange, forever got A+, and passed with honors dependability. However in august, I needed to impose upon a look and customise some of the functions offered not later than python as regards creating a snare server. expressly How’s that as regards a letter of recommendation?[AL] I minimize tcl a a barrel and python sheerest picayune. And what I establish was over-nice, unquestionably organised, amply documented. If you look as regards a wiki syntax interpreter in python, you drive command divers fire up, a understandable tcl library does not naЛve to my best bib familiarity. Having habituated to more than simultaneously tclhttpd, I would not in any MO , not in any MO , justification the tclhttpd cipher in the nonetheless MO .
We also do not hint a over-nice tutorial/reference get going inception log as the python documentation. iu2 Here is a picayune nibble I wrote as regards both Python and tcl. So we hint some MO to away to continue up Python. I started in Python then moved to tcl, and it seemed to me that it is advantage posting.
The nibble allows creating circles and squares in a canvas, and allows impressive them here.