blob: e508207521dda5699b87a6e658f8b7d98cddc3e0 [file] [log] [blame]
Guido van Rossuma7925f11994-01-26 10:20:16 +00001Newsgroups: comp.lang.perl,comp.lang.tcl
2From: lutz@xvt.com (Mark Lutz)
3Subject: Python (was Re: Has anyone done a tk addition to perl?)
4Organization: XVT Software Inc.
5Date: Thu, 14 Oct 1993 17:10:37 GMT
6X-Disclaimer: The views expressed in this message are those of an
7 individual at XVT Software Inc., and do not necessarily
8 reflect those of the company.
9
10
11I've gotten a number of requests for information about Python,
12since my post here earlier this week. Since this appears to be
13of general interest, and since there's no python news group yet,
14I'm posting a description here. I'm not the best authority on
15the language, but here's my take on it.
16
17[TCL/Perl zealots: this is informational only; I'm not trying to
18'convert' anybody, and don't have time for a language war :-)
19There is a paper comparing TCL/Perl/Python/Emacs-Lisp, which is
20referenced in the comp.lang.misc faq, I beleive.]
21
22
23What is Python?...
24
25Python is a relatively new very-high-level language developed
26in Amsterdam. Python is a simple, procedural language, with
27features taken from ABC, Icon, Modula-3, and C/C++.
28
29It's central goal is to provide the best of both worlds:
30the dynamic nature of scripting languages like Perl/TCL/REXX,
31but also support for general programming found in the more
32traditional languages like Icon, C, Modula,...
33
34As such, it can function as a scripting/extension language,
35as a rapid prototyping language, and as a serious software
36development language. Python is suitable for fast development
37of large programs, but also does well at throw-away shell coding.
38
39Python resembles other scripting languages a number of ways:
40 - dynamic, interpretive, interactive nature
41 - no explicit compile or link steps needed
42 - no type declarations (it's dynamically typed)
43 - high-level operators ('in', concatenation, etc)
44 - automatic memory allocation/deallocation (no 'pointers')
45 - high level objects: lists, tuples, strings, associative arrays
46 - programs can construct and execute program code using strings
47 - very fast edit/compile/run cycle; no static linking
48 - well-defined interface to and from C functions and data
49 - well-defined ways to add C modules to the system and language
50
51Python's features that make it useful for serious programming:
52 - it's object-oriented; it has a simplified subset of
53 C++'s 'class' facility, made more useful by python's
54 dynamic typing; the language is object-oriented from
55 the ground up (rather than being an add-on, as in C++)
56
57 - it supports modules (imported packages, as in Modula-3);
58 modules replace C's 'include' files and linking, and allow
59 for multiple-module systems, code sharing, etc.;
60
61 - it has a good exception handling system (a 'try' statement,
62 and a 'raise' statement, with user-defined exceptions);
63
64 - it's orthogonal; everything is a first-class object in the
65 language (functions, modules, classes, class instance methods...)
66 and can be assigned/passed and used generically;
67
68 - it's fairly run-time secure; it does many run-time checks
69 like index-out-of-bounds, etc., that C usually doesn't;
70
71 - it has general data structuring support; Python lists are
72 heterogeneous, variable length, nestable, support slicing,
73 concatenation, etc., and come into existance and are reclaimed
74 automatically; strings and dictionaries are similarly general;
75
76 - it's got a symbolic debugger and profiler (written in python,
77 of course..), and an interactive command-line interface;
78 as in Lisp, you can enter code and test functions in isolation,
79 from the interactive command line (even linked C functions);
80
81 - it has a large library of built-in modules; it has support
82 for sockets, regular expressions, posix bindings, etc.
83
84 - it supports dynamic loading of C modules on many platforms;
85
86 - it has a _readable_ syntax; python code looks like normal
87 programming languages; tcl and perl can be very unreadable
88 (IMHO; what was that joke about Perl looking the same after
89 rot13..); python's syntax is simple, and statement based;
90
91
92Of course, Python isn't perfect, but it's a good compromise betweem
93scripting languages and traditional ones, and so is widely applicable.
94'Perfect' languages aren't always useful for real-world tasks (Prolog,
95for example), and languages at either extreme are not useful in the other
96domain (C is poor for shell coding and prototyping, and awk is useless
97for large systems design; Python does both well).
98
99For example, I've used Python successfully for a 4K line expert system
100shell project; it would have been at least twice as large in C, and would
101have been very difficult in TCL or Perl.
102
103Python uses an indentation-based syntax which may seem unusual at first
104to C coders, but after using it I have found it to be _very_ handy, since
105there's less to type. [I now forget to type '}' in my C code, and am
106busy calculating how much time I wasted typing all those '}', 'END', etc.,
107just to pander to 'brain-dead' C/Pascal compilers :-)].
108
109Python's currently at release 0.9.9. It seems suprisingly stable.
110The first 'official' 1.0 release is due out by the end of this year.
111Python runs on most popular machines/systems (mac, dos, unix, etc.)
112It's public domain and distributable, and can be had via ftp. The
113distribution includes examples, tutorials, and documentation. The
114latest ftp address I have (I got it on a cd-rom):
115 pub/python/* at ftp.cwi.nl
116 pub/? at wuarchive.wustl.edu (in america)
117
118There's a python mailing list maintained by the language's creator.
119Mail 'python-list-request@cwi.nl' to get on it.
120
121Mark Lutz
122lutz@xvt.com