diff options
author | Guido van Rossum <guido@python.org> | 1994-01-26 10:20:16 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1994-01-26 10:20:16 (GMT) |
commit | a7925f18ded087c10d2a0f971e320e5f89380288 (patch) | |
tree | 5c965cb425f23e5286d1bc94ff01b66039b531c9 /Misc/BLURB | |
parent | 8f0d0c8a210fe80832cbae0cc4a381439647bf9e (diff) | |
download | cpython-a7925f18ded087c10d2a0f971e320e5f89380288.zip cpython-a7925f18ded087c10d2a0f971e320e5f89380288.tar.gz cpython-a7925f18ded087c10d2a0f971e320e5f89380288.tar.bz2 |
Initial revision
Diffstat (limited to 'Misc/BLURB')
-rw-r--r-- | Misc/BLURB | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/Misc/BLURB b/Misc/BLURB new file mode 100644 index 0000000..53cf55b --- /dev/null +++ b/Misc/BLURB @@ -0,0 +1,45 @@ +What is Python? +--------------- + +Python is an interpreted, interactive, object-oriented programming +language. It incorporates modules, exceptions, dynamic typing, very +high level dynamic data types, and classes. Python combines +remarkable power with very clear syntax. It has interfaces to many +system calls and libraries, as well as to various window systems, and +is extensible in C or C++. It is also usable as an extension language +for applications that need a programmable interface. Finally, Python +is portable: it runs on many brands of UNIX, on the Mac, and on +MS-DOS. + +As a short example of what Python looks like, here's a script to +print prime numbers (not blazingly fast, but readable!). When this +file is made executable, it is callable directly from the UNIX shell +(if your system supports #! in scripts and the python interpreter is +installed at the indicated place). + +#!/usr/local/bin/python + +# Print prime numbers in a given range + +def main(): + import sys + min, max = 2, 0x7fffffff + if sys.argv[1:]: + min = int(eval(sys.argv[1])) + if sys.argv[2:]: + max = int(eval(sys.argv[2])) + primes(min, max) + +def primes(min, max): + if 2 >= min: print 2 + primes = [2] + i = 3 + while i <= max: + for p in primes: + if i%p == 0 or p*p > i: break + if i%p <> 0: + primes.append(i) + if i >= min: print i + i = i+2 + +main() |