|
| 1 | +Newsgroups: comp.lang.perl,comp.lang.tcl |
| 2 | +From: [email protected] (Mark Lutz) |
| 3 | +Subject: Python (was Re: Has anyone done a tk addition to perl?) |
| 4 | +Organization: XVT Software Inc. |
| 5 | +Date: Thu, 14 Oct 1993 17:10:37 GMT |
| 6 | +X-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 | + |
| 11 | +I've gotten a number of requests for information about Python, |
| 12 | +since my post here earlier this week. Since this appears to be |
| 13 | +of general interest, and since there's no python news group yet, |
| 14 | +I'm posting a description here. I'm not the best authority on |
| 15 | +the 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 :-) |
| 19 | +There is a paper comparing TCL/Perl/Python/Emacs-Lisp, which is |
| 20 | +referenced in the comp.lang.misc faq, I beleive.] |
| 21 | + |
| 22 | + |
| 23 | +What is Python?... |
| 24 | + |
| 25 | +Python is a relatively new very-high-level language developed |
| 26 | +in Amsterdam. Python is a simple, procedural language, with |
| 27 | +features taken from ABC, Icon, Modula-3, and C/C++. |
| 28 | + |
| 29 | +It's central goal is to provide the best of both worlds: |
| 30 | +the dynamic nature of scripting languages like Perl/TCL/REXX, |
| 31 | +but also support for general programming found in the more |
| 32 | +traditional languages like Icon, C, Modula,... |
| 33 | + |
| 34 | +As such, it can function as a scripting/extension language, |
| 35 | +as a rapid prototyping language, and as a serious software |
| 36 | +development language. Python is suitable for fast development |
| 37 | +of large programs, but also does well at throw-away shell coding. |
| 38 | + |
| 39 | +Python 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 | + |
| 51 | +Python'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 | + |
| 92 | +Of course, Python isn't perfect, but it's a good compromise betweem |
| 93 | +scripting languages and traditional ones, and so is widely applicable. |
| 94 | +'Perfect' languages aren't always useful for real-world tasks (Prolog, |
| 95 | +for example), and languages at either extreme are not useful in the other |
| 96 | +domain (C is poor for shell coding and prototyping, and awk is useless |
| 97 | +for large systems design; Python does both well). |
| 98 | + |
| 99 | +For example, I've used Python successfully for a 4K line expert system |
| 100 | +shell project; it would have been at least twice as large in C, and would |
| 101 | +have been very difficult in TCL or Perl. |
| 102 | + |
| 103 | +Python uses an indentation-based syntax which may seem unusual at first |
| 104 | +to C coders, but after using it I have found it to be _very_ handy, since |
| 105 | +there's less to type. [I now forget to type '}' in my C code, and am |
| 106 | +busy calculating how much time I wasted typing all those '}', 'END', etc., |
| 107 | +just to pander to 'brain-dead' C/Pascal compilers :-)]. |
| 108 | + |
| 109 | +Python's currently at release 0.9.9. It seems suprisingly stable. |
| 110 | +The first 'official' 1.0 release is due out by the end of this year. |
| 111 | +Python runs on most popular machines/systems (mac, dos, unix, etc.) |
| 112 | +It's public domain and distributable, and can be had via ftp. The |
| 113 | +distribution includes examples, tutorials, and documentation. The |
| 114 | +latest 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 | + |
| 118 | +There's a python mailing list maintained by the language's creator. |
| 119 | +Mail ' [email protected]' to get on it. |
| 120 | + |
| 121 | +Mark Lutz |
| 122 | + |
0 commit comments