/ TCC Help System
/ Site map
/ NM Tech homepage
Python vs. the Icon programming language
The author had written well over 150,000 lines of Icon when
he first learned Python. This comparison is based on relatively
little actual experience with Python, and reflects more the
author's prejudices in the theory of sound language design.
Advantages of Icon over Python
- The concept of an
implicit scan subject is a real
timesaver when writing text-processing applications. However,
it can be nuisance when verifying programs, because one must
keep track of whether any operations have changed the
implicit subject. In Python, I've
implemented a "
Scan object" that implements
Icon scanning, but the instances internalize such side
effects, making your code easier to verify. See my
library page for
Scan and other objects
derived from Icon constructs.
- In Icon, you can ask the language to check for undeclared
variables. I prefer to have to declare everything, both because
it catches many errors resulting from typos, and also because
it gives me a place to comment the purpose of each variable.
- I prefer the way Icon implemented built-in variables such
as &null. The Python equivalent, None,
is not syntactically distinguished from other variables (as
the & sets off Icon built-ins). Worse,
you can clobber None by storing a value into it!
[Note: Python 2.3 and later will warn you if you clobber
- Icon has a single graphics (GUI) interface that works the same across
all platforms (or will, once they all get ported). Python
has several GUI interfaces, each of which has advantages
on specific platforms, and none are as clean and elegant as
in Icon has no direct equivalent in
Python. Accordingly, Python functions such as string.uppercase
are biased toward a particular set of characters, while Icon
can provide more generalized services. I miss the cset
type in text-processing applications.
In the original version of this page, I touted Icon's
generators as an advantage. However, generators are now a
feature of Python, since Python 2.2.
Advantages of Python over Icon
- Python has a lot more momentum and a much larger and more
vigorous user community.
- Python interfaces already exist to a wide variety of
systems programming facilities (such as directories and TCP/IP
sockets), databases, other languages, and much more.
- Python is much more suitable for embedding (called by other
languages) and extending (calling other languages).
- Python is a more object-oriented language. I've done a
fair amount of o-o programming in Icon (see my
page), but Icon is not an o-o language per se.
Since about 2000 I have not used Icon at all, except to
maintain a few legacy applications. The two biggest factors in
this choice were the size and universality of Python's library,
and the good object model.
Both Python and Icon are freely available and run on a wide
variety of platforms.
Next: Documentation for the Python programming language
See also: The Python programming language; The Icon programming language
Previous: Python vs. the Perl programming language
to help pages
New Mexico Tech Computer Center: Help System
To report a problem: File a ticket
Send mail to the User consultant
on duty or call them at 575-835-5437
About New Mexico Tech
John Shipman, firstname.lastname@example.org
Last updated: 2005/04/07 21:54:35 UT