Use py_resource module
[python/dscho.git] / Misc / BLURB
blob53cf55b15ee69b3914be40088fa83b0ed5ecff3a
1 What is Python?
2 ---------------
4 Python is an interpreted, interactive, object-oriented programming
5 language.  It incorporates modules, exceptions, dynamic typing, very
6 high level dynamic data types, and classes.  Python combines
7 remarkable power with very clear syntax.  It has interfaces to many
8 system calls and libraries, as well as to various window systems, and
9 is extensible in C or C++.  It is also usable as an extension language
10 for applications that need a programmable interface.  Finally, Python
11 is portable: it runs on many brands of UNIX, on the Mac, and on
12 MS-DOS.
14 As a short example of what Python looks like, here's a script to
15 print prime numbers (not blazingly fast, but readable!).  When this
16 file is made executable, it is callable directly from the UNIX shell
17 (if your system supports #! in scripts and the python interpreter is
18 installed at the indicated place).
20 #!/usr/local/bin/python
22 # Print prime numbers in a given range
24 def main():
25         import sys
26         min, max = 2, 0x7fffffff
27         if sys.argv[1:]:
28                 min = int(eval(sys.argv[1]))
29                 if sys.argv[2:]:
30                         max = int(eval(sys.argv[2]))
31         primes(min, max)
33 def primes(min, max):
34         if 2 >= min: print 2
35         primes = [2]
36         i = 3
37         while i <= max:
38                 for p in primes:
39                         if i%p == 0 or p*p > i: break
40                 if i%p <> 0:
41                         primes.append(i)
42                         if i >= min: print i
43                 i = i+2
45 main()