blob: 76becaa86c8eedde44dcdb4cf76bb8e904f827ae [file] [log] [blame]
Guido van Rossuma7925f11994-01-26 10:20:16 +00001Subject: FAQ: Python -- an object-oriented language
2Newsgroups: comp.lang.misc,comp.answers,news.answers
3Followup-to: comp.lang.misc
4From: guido@cwi.nl (Guido van Rossum)
5Reply-to: guido@cwi.nl (Guido van Rossum)
6Approved: news-answers-request@MIT.Edu
7
8Archive-name: python-faq/part1
Guido van Rossum95f61a71994-01-26 17:23:37 +00009Version: 1.3
10Last-modified: 26 Jan 1994
Guido van Rossuma7925f11994-01-26 10:20:16 +000011
12This article contains answers to Frequently Asked Questions about
13Python (an object-oriented interpreted programming language -- see
14the answer to question 1.1 for a short overview).
15
16Copyright 1993, 1994 Guido van Rossum. Unchanged electronic
17redistribution of this FAQ is allowed. Printed redistribution only
18with permission of the author. No warranties.
19
20Author's address:
21 Guido van Rossum
22 CWI, dept. CST
23 Kruislaan 413
24 P.O. Box 94079
25 1090 GB Amsterdam
26 The Netherlands
27Email: guido@cwi.nl
28
29The latest version of this FAQ is available by anonymous ftp from
30ftp.cwi.nl [192.16.184.180] in the directory /pub/python, with
31filename python-FAQ. It will also be posted regularly to the
32newsgroups comp.answers and comp.lang.misc.
33
34Many FAQs, including this one, are available by anonymous ftp from
35rtfm.mit.edu [18.70.0.209] in the directory pub/usenet/news.answers.
36The name under which a FAQ is archived appears in the Archive-name line
37at the top of the article. This FAQ is archived as python-faq/part1.
38
39There's a mail server on that machine which will send you files from
40the archive by e-mail if you have no ftp access. You send a e-mail
41message to mail-server@rtfm.mit.edu containing the single word help in
42the message body to receive instructions.
43
44This FAQ is divided in the following chapters:
45
46 1. General information and availability
47 2. Python in the real world
48 3. Building Python
49 4. Programming in Python
50 5. Extending Python
51 6. Python's design
52 7. Using Python on non-UNIX platforms
53
54To find the start of a particular chapter, search for the chapter number
55followed by a dot and a space at the beginning of a line (e.g. to
56find chapter 4 in vi, type /^4\. /).
57
58Here's an overview of the questions per chapter:
59
60 1. General information and availability
61 1.1. Q. What is Python?
62 1.2. Q. Why is it called Python?
63 1.3. Q. How do I obtain a copy of the Python source?
64 1.4. Q. How do I get documentation on Python?
65 1.5. Q. Is there a newsgroup or mailing list devoted to Python?
66 1.6. Q. Is there a book on Python, or will there be one out soon?
67 1.7. Q. Are there any published articles about Python that I can quote?
Guido van Rossum95f61a71994-01-26 17:23:37 +000068 1.8. Q. How does the Python version numbering scheme work?
Guido van Rossuma7925f11994-01-26 10:20:16 +000069
70 2. Python in the real world
71 2.1. Q. How many people are using Python?
72 2.2. Q. Have any significant projects been done in Python?
73 2.3. Q. Are there any commercial projects going on using Python?
Guido van Rossum95f61a71994-01-26 17:23:37 +000074 2.4. Q. How stable is Python?
75 2.5. Q. What new developments are expected for Python in the future?
Guido van Rossuma7925f11994-01-26 10:20:16 +000076
77 3. Building Python
78 3.1. Q. I have trouble building the md5 module and/or finding the file
79 md5.c.
80 3.2. Q. Is there a test set?
81 3.3. Q. When running the test set, I get complaints about floating point
82 operations, but when playing with floating point operations I cannot
83 find anything wrong with them.
84 3.4. Q. I get an OverflowError on evaluating 2*2. What is going on?
Guido van Rossum95f61a71994-01-26 17:23:37 +000085 3.5. Q. Trouble building Python 0.9.9 or earlier on platform X.
86 3.6. Q. Trouble building Python 1.0.0 on platform X.
Guido van Rossuma7925f11994-01-26 10:20:16 +000087
88 4. Programming in Python
89 4.1. Q. Can I create an object class with some methods implemented in
90 C and others in Python (e.g. through inheritance)? (Also phrased as:
91 Can I use a built-in type as base class?)
92 4.2. Q. I assign to a variable in a call to exec() but when I try to
93 use it on the next line I get an error. What is going on?
94 4.3. Q. Why does that work?
95 4.4. Q. Is there a curses/termcap package for Python?
96 4.5. Q. Is there an equivalent to C's onexit() in Python?
97 4.6. Q. When I define a function nested inside another function, the
98 nested function seemingly can't access the local variables of the
99 outer function. What is going on? How do I pass local data to a
100 nested function?
101 4.7. Q. How do I iterate over a sequence in reverse order?
102 4.8. Q. My program is too slow. How do I speed it up?
103 4.9. Q. When I have imported a module, then edit it, and import it
104 again (into the same Python process), the changes don't seem to take
105 place. What is going on?
106
107 5. Extending Python
108 5.1. Q. Can I create my own functions in C?
109 5.2. Q. Can I create my own functions in C++?
110
111 6. Python's design
112 6.1. Q. Why isn't there a generic copying operation for objects in
113 Python?
114 6.2. Q. Why isn't there a generic way to implement persistent objects
115 in Python? (Persistent == automatically saved to and restored from
116 disk.)
117 6.3. Q. Why isn't there a switch or case statement in Python?
118
119 7. Using Python on non-UNIX platforms
Guido van Rossum95f61a71994-01-26 17:23:37 +0000120 7.1. Q. Where's the DOS version of 1.0.0?
Guido van Rossuma7925f11994-01-26 10:20:16 +0000121 7.2. Q. Is there a Windows version of Python?
122 7.3. Q. I have the Mac or DOS version but it appears to be only a binary.
123 Where's the library?
124 7.4. Q. Where's the documentation for the Mac or DOS version?
125 7.5. Q. The Mac version doesn't seem to have any facilities for creating or
126 editing programs apart from entering it interactively, and there seems
127 to be no way to save code that was entered interactively. How do I
128 create a Python program on the Mac?
129
130To find a particular question, search for the question number followed
131by a dot, a space, and a Q at the beginning of a line (e.g. to find
132question 4.2 in vi, type /^4\.2\. Q/).
133
134
1351. General information and availability
136=======================================
137
1381.1. Q. What is Python?
139
140A. Python is an interpreted, interactive, object-oriented programming
141language. It incorporates modules, exceptions, dynamic typing, very
142high level dynamic data types, and classes. Python combines
143remarkable power with very clear syntax. It has interfaces to many
144system calls and libraries, as well as to various window systems, and
145is extensible in C or C++. It is also usable as an extension language
146for applications that need a programmable interface. Finally, Python
147is portable: it runs on many brands of UNIX, on the Mac, and on
148MS-DOS.
149
150To find out more, the best thing to do is to start reading the
151tutorial from the documentation set (see a few questions further
152down).
153
1541.2. Q. Why is it called Python?
155
156A. Apart from being a computer wizard, I'm also a fan of "Monty
157Python's Flying Circus" (a BBC comedy series from the seventies, in
158case you didn't know). It occurred to me one day that I needed a name
159that was short, unique, and slightly mysterious. And I happened to be
160reading some scripts from the series at the time... So then I decided
161to call my language Python. But Python is not a joke. And don't you
162associate it with dangerous reptiles either!
163
1641.3. Q. How do I obtain a copy of the Python source?
165
166A. The latest Python source distribution is always available by
167anonymous ftp from ftp.cwi.nl [192.16.184.180] in the directory
168/pub/python, with filename python<version>.tar.Z. It is a compressed
169tar file containing the complete C source, LaTeX documentation, Python
170library modules, example programs, and several useful pieces of freely
171distributable software. This will compile and run out of the box on
Guido van Rossum95f61a71994-01-26 17:23:37 +0000172most UNIX platforms. Currently <version> is 1.0.0. (See section 7
Guido van Rossuma7925f11994-01-26 10:20:16 +0000173for non-UNIX information.)
174
1751.4. Q. How do I get documentation on Python?
176
177A. The latest Python documentation set is always available by
178anonymous ftp from ftp.cwi.nl [192.16.184.180] in the directory
179/pub/python, with filename pythondoc-ps<version>.tar.Z. It is a
180compressed tar file containing PostScript files of the reference
181manual, the library manual, and the tutorial. Currently <version> is
Guido van Rossum95f61a71994-01-26 17:23:37 +00001821.0.0. (Note that the library manual is the most important one of the
Guido van Rossuma7925f11994-01-26 10:20:16 +0000183set, as much of Python's power stems from the standard or built-in
184types, functions and modules, all of which are described here.)
185PostScript for a high-level description of Python is in the file
186nluug-paper.ps.
187
188The following sites keep mirrors of the Python distribution:
189
190Site IP address Directory
191
192gatekeeper.dec.com 16.1.0.2 /pub/plan/python/cwi
193ftp.uu.net 192.48.96.9 /languages/python
194ftp.wustl.edu 128.252.135.4 /graphics/graphics/sgi-stuff/python
195ftp.funet.fi 128.214.6.100 /pub/languages/python (old?)
196ftp.fu-berlin.de 130.133.4.50 /pub/unix/languages/python (python* only)
197
Guido van Rossum95f61a71994-01-26 17:23:37 +0000198Or try archie on e.g. python1.0.0.tar.Z to locate the nearest copy of
Guido van Rossuma7925f11994-01-26 10:20:16 +0000199that version...
200
2011.5. Q. Is there a newsgroup or mailing list devoted to Python?
202
203A. There is no Python newsgroup yet; if you want to post to the net
204about Python, use comp.lang.misc. There is a mailing list devoted to
205Python; send e-mail to python-list-request@cwi.nl to (un)subscribe.
206There are plans to start the discussion about creation of
207comp.lang.python as soon as version 1.0.0 has been released.
208
2091.6. Q. Is there a book on Python, or will there be one out soon?
210
211A. Unfortunately, not yet. I would like to write one but my
212obligations at CWI include too much other work to make much progress
213on it. Several parties have expressed interest in sponsoring or
214helping the production of a book or reference manual, but so far there
215are no firm plans. If you volunteer help, by all means drop me a
216note!
217
2181.7. Q. Are there any published articles about Python that I can quote?
219
220A. So far the only refereed and published article that describes
221Python in some detail is:
222
223 Guido van Rossum and Jelke de Boer, "Interactively Testing Remote
224 Servers Using the Python Programming Language", CWI Quarterly, Volume
225 4, Issue 4 (December 1991), Amsterdam, pp 283-303.
226
227LaTeX source for this paper is available as part of the Python source
228distribution.
229
230A more recent high-level description of Python is:
231
232 Guido van Rossum, "An Introduction to Python for UNIX/C
233 Programmers", in the proceedings of the NLUUG najaarsconferentie
234 1993 (dutch UNIX users group meeting november 1993).
235
236PostScript for this paper and for the slides used for the accompanying
237presentation can be found in the ftp directory mentioned a few
238questions earlier, with filenames nluug-paper.ps and nluug-slides.ps,
239respectively.
240
Guido van Rossum95f61a71994-01-26 17:23:37 +00002411.8. Q. How does the Python version numbering scheme work?
242
243A. Python versions are numbered A.B.C. A is the major version number
244-- it is only incremented for major changes in functionality or source
245structure. B is the minor version number, incremented for less
246earth-shattering changes to a release. C is the patchlevel -- it is
247incremented for each new release. Note that in the past, patches have
248added significant changes; in fact the changeover from 0.9.9 to 1.0.0
249was the first time that either A or B changed!
250
Guido van Rossuma7925f11994-01-26 10:20:16 +0000251
2522. Python in the real world
253===========================
254
2552.1. Q. How many people are using Python?
256
257A. I don't know, but at the last count there were at least 130
258addresses on the Python mailing list (several of which are local
259redistribution lists). I suspect that many users don't bother
260to subscribe to the list.
261
2622.2. Q. Have any significant projects been done in Python?
263
264A. Here at CWI (the home of Python), we have written a 20,000 line
265authoring environment for transportable hypermedia presentations, a
266multimedia teleconferencing tool, as well as many smaller programs.
267
268The University of Virginia uses Python to control a virtual reality
269engine. Contact: Matt Conway <conway@virginia.edu>.
270
271See also the next question.
272
2732.3. Q. Are there any commercial projects going on using Python?
274
275A. Several companies have revealed to me that they are planning or
276considering to use Python in a future product. The furthest is
277Sunrise Software, who already have a product out using Python -- they
278use Python for a GUI management application and an SNMP network
279manangement application. Contact: <info@sunrise.com>.
280
281Individuals at many other companies are using Python for
282internal development (witness their contributions to the Python
283mailing list).
284
285Python has also been elected as an extension language by MADE, a
286consortium supported by the European Committee's ESPRIT program and
287consisting of Bull, CWI and some other European companies. Contact:
288Ivan Herman <ivan@cwi.nl>.
289
Guido van Rossum95f61a71994-01-26 17:23:37 +00002902.4. Q. How stable is Python?
Guido van Rossuma7925f11994-01-26 10:20:16 +0000291
Guido van Rossum95f61a71994-01-26 17:23:37 +0000292A. Very stable. While the current version number (1.0.0) would
Guido van Rossuma7925f11994-01-26 10:20:16 +0000293suggest it is in the early stages of development, in fact new, stable
Guido van Rossum95f61a71994-01-26 17:23:37 +0000294releases (numbered 0.9.x) have been coming out roughly every 3 to 6
295months for the past four years.
Guido van Rossuma7925f11994-01-26 10:20:16 +0000296
Guido van Rossum95f61a71994-01-26 17:23:37 +00002972.5. Q. What new developments are expected for Python in the future?
Guido van Rossuma7925f11994-01-26 10:20:16 +0000298
Guido van Rossum95f61a71994-01-26 17:23:37 +0000299A. Without warranty that any of this will actually be realized: I am
Guido van Rossuma7925f11994-01-26 10:20:16 +0000300currently thinking about mechanisms for built-in on-line help and a
Guido van Rossum99bf2501994-01-26 17:30:41 +0000301switch/case statement. There have been some discussions on
302hierarchical module names which might solve the problem of the
303development of large packages. A pthreads interface has been
304contributed which I would like to merge into the latest release. The
305X interface needs improving. There are also some people
306(independently) working on a windowing interface based on STDWIN but
307with the power and ease of use of the average modern widget set. I
308still hope to get some help in producing a Windows version. It would
309be nice if there were a window-based class browser (Someone at CWI has
310contributed one using Motif but it needs some work). Also: improved
311support for embedding Python in other applications, e.g. by renaming
312most global symbols to have a "Py" prefix and providing more
313documentation and threading support.
Guido van Rossuma7925f11994-01-26 10:20:16 +0000314
315
3163. Building Python
317==================
318
3193.1. Q. I have trouble building the md5 module and/or finding the file
320md5.c.
321
322A. Apparently the md5 module was based on an older version of RSA's
323md5 implementation. The ftp site rsa.com mentioned in the Makefile
324where this version was found is no longer accessible, and the version
325from RFC 1321 (md5c.c) is slightly different. This will be fixed in
326the 1.0 release; write me if you need the fixes now.
327
3283.2. Q. Is there a test set?
329
330A. Yes, simply do "import testall" (or "import autotest" if you aren't
331interested in the output). The standard modules whose name begins
332with "test" together comprise the test. The test set doesn't test
333*all* features of Python but it goes a long way to confirm that a new
334port is actually working. The Makefile contains an entry "make test"
335which runs the autotest module.
336
3373.3. Q. When running the test set, I get complaints about floating point
338operations, but when playing with floating point operations I cannot
339find anything wrong with them.
340
341A. The test set makes occasional unwarranted assumptions about the
342semantics of C floating point operations. Until someone donates a
343better floating point test set, you will have to comment out the
344offending floating point tests and execute similar tests manually.
345
3463.4. Q. I get an OverflowError on evaluating 2*2. What is going on?
347
348A. Your machine probably has 64 bit long integers (e.g. DEC alpha or
349HP snake architectures). There are some dependencies on word length
350in file intobject.c. This will be corrected in the 1.0 release; until
351then, on a 64 bit machine, just comment out the check for overflow
352from int_mul:
353
354 #if 0
355 if (x > 0x7fffffff || x < (double) (long) 0x80000000)
356 return err_ovf("integer multiplication");
357 #endif
358
359You should also include <limits.h> and replace the constant 32 by
360LONG_BIT in int_[lr]shift.
361
Guido van Rossum95f61a71994-01-26 17:23:37 +00003623.5. Q. Trouble building Python 0.9.9 or earlier on platform X.
Guido van Rossuma7925f11994-01-26 10:20:16 +0000363
Guido van Rossum95f61a71994-01-26 17:23:37 +0000364Please convert to Python 1.0.0 -- it is much more portable.
365
3663.6. Q. Trouble building Python 1.0.0 on platform X.
367
368A. Please email the details to <guido@cwi.nl> and I'll look into it.
Guido van Rossuma7925f11994-01-26 10:20:16 +0000369
370
3714. Programming in Python
372========================
373
3744.1. Q. Can I create an object class with some methods implemented in
375C and others in Python (e.g. through inheritance)? (Also phrased as:
376Can I use a built-in type as base class?)
377
378A. No, but you can easily create a Python class which serves as a
379wrapper around a built-in object, e.g. (for dictionaries):
380
381 # A user-defined class behaving almost identical
382 # to a built-in dictionary.
383 class UserDict:
384 def __init__(self): self.data = {}
385 def __repr__(self): return repr(self.data)
386 def __cmp__(self, dict):
387 if type(dict) == type(self.data):
388 return cmp(self.data, dict)
389 else:
390 return cmp(self.data, dict.data)
391 def __len__(self): return len(self.data)
392 def __getitem__(self, key): return self.data[key]
393 def __setitem__(self, key, item): self.data[key] = item
394 def __delitem__(self, key): del self.data[key]
395 def keys(self): return self.data.keys()
396 def items(self): return self.data.items()
397 def values(self): return self.data.values()
398 def has_key(self, key): return self.data.has_key(key)
399
4004.2. Q. I assign to a variable in a call to exec() but when I try to
401use it on the next line I get an error. What is going on?
402
403A. The reason why this occurs is too complicated to explain (but see
404the next question). To fix it is easy, however: simply assign None to
405the variable *before* calling exec(). This will be fixed in the 1.0
406release.
407
4084.3. Q. Why does that work?
409
410A. When parsing your program and converting it into internal pseudo
411code, the interpreter does some optimizations to speed up function
412execution: it figures out the names of all the local variables and
413treats them specially. Because your assignment is done by exec(), it
414is not seen initially by the parser and the variable is not recognized
415as a local variable. The default treatment is as a global variable,
416but the exec() statement places it in the local scope, where it is not
417found. This will be fixed in release 1.0 by making exec into a
418statement; the parser will then be able to switch off the
419optimizations for local variables if it encounters an exec statement
420(recognizing calls to built-in functions is not possible for the
421parser, hence the syntax change to a statement).
422
4234.4. Q. Is there a curses/termcap package for Python?
424
425A. No, but you can use the "alfa" (== character cell) version of
426STDWIN. (STDWIN == Standard Windows, a portable windowing system
427interface by the same author, URL ftp://ftp.cwi.nl/pub/stdwin.)
428This will also prepare your program for porting to windowing
429environments such as X11 or the Macintosh.
430
4314.5. Q. Is there an equivalent to C's onexit() in Python?
432
433A. Yes, if you import sys and assign a function to sys.exitfunc, it
434will be called when your program exits, is killed by an unhandled
435exception, or (on UNIX) receives a SIGHUP or SIGTERM signal.
436
4374.6. Q. When I define a function nested inside another function, the
438nested function seemingly can't access the local variables of the
439outer function. What is going on? How do I pass local data to a
440nested function?
441
442A. Python does not have arbitrarily nested scopes. When you need to
443create a function that needs to access some data which you have
444available locally, create a new class to hold the data and return a
445method of an instance of that class, e.g.:
446
447 class MultiplierClass:
448 def __init__(self, factor):
449 self.factor = factor
450 def multiplier(self, argument):
451 return argument * self.factor
452
453 def generate_multiplier(factor):
454 return MultiplierClass(factor).multiplier
455
456 twice = generate_multiplier(2)
457 print twice(10)
458 # Output: 20
459
4604.7. Q. How do I iterate over a sequence in reverse order?
461
462A. If it is a list, the fastest solution is
463
464 list.reverse()
465 try:
466 for x in list:
467 "do something with x"
468 finally:
469 list.reverse()
470
471This has the disadvantage that while you are in the loop, the list
472is temporarily reversed. If you don't like this, you can make a copy.
473This appears expensive but is actually faster than other solutions:
474
475 rev = list[:]
476 rev.reverse()
477 for x in rev:
478 <do something with x>
479
480If it isn't a list, a more general but slower solution is:
481
482 i = len(list)
483 while i > 0:
484 i = i-1
485 x = list[i]
486 <do something with x>
487
488A more elegant solution, is to define a class which acts as a sequence
489and yields the elements in reverse order (solution due to Steve
490Majewski):
491
492 class Rev:
493 def __init__(self, seq):
494 self.forw = seq
495 def __len__(self):
496 return len(self.forw)
497 def __getitem__(self, i):
498 return self.forw[-(i + 1)]
499
500You can now simply write:
501
502 for x in Rev(list):
503 <do something with x>
504
505Unfortunately, this solution is slowest of all, due the the method
506call overhead...
507
5084.8. Q. My program is too slow. How do I speed it up?
509
510A. That's a tough one, in general. There are many tricks to speed up
511Python code; I would consider rewriting parts in C only as a last
512resort. One thing to notice is that function and (especially) method
513calls are rather expensive; if you have designed a purely OO interface
514with lots of tiny functions that don't do much more than get or set an
515instance variable or call another method, you may consider using a
516more direct way, e.g. directly accessing instance variables. Also see
517the standard module "profile" (described in the file
518"python/lib/profile.doc") which makes it possible to find out where
519your program is spending most of its time (if you have some patience
520-- the profiling itself can slow your program down by an order of
521magnitude).
522
5234.9. Q. When I have imported a module, then edit it, and import it
524again (into the same Python process), the changes don't seem to take
525place. What is going on?
526
527A. For efficiency reasons, Python only reads the module file on the
528first time a module is imported (otherwise a program consisting of
529many modules, each of which imports the same basic module, would read
530the basic module over and over again). To force a changed module
531being read again, do this:
532
533 import modname
534 reload(modname)
535
536Warning: this technique is not 100% fool-proof. In particular,
537modules containing statements like
538
539 from modname import some_objects
540
541will continue to work with the old version of the objects imported
542thus.
543
544
5455. Extending Python
546===================
547
5485.1. Q. Can I create my own functions in C?
549
550A. Yes, you can create built-in modules containing functions,
551variables, exceptions and even new types in C. This is all explained
552in the file "python/misc/EXTENDING". Also read the file "DYNLOAD"
553there for hints on how to load such extension modules
554
5555.2. Q. Can I create my own functions in C++?
556
557A. Yes, using the C-compatibility features found in C++. Basically
558you place extern "C" { ... } around the Python include files and put
559extern "C" before each function that is going to be called by the
560Python interpreter. Global or static C++ objects with constructors
561are probably not a good idea.
562
563
5646. Python's design
565==================
566
5676.1. Q. Why isn't there a generic copying operation for objects in
568Python?
569
570A. Hmm. Maybe there should be one, but it's difficult to assign a
571useful meaning to copying of open files, sockets and windows, or
572recursive data structures. As long as you design all your classes
573yourself you are of course free to define a standard base class that
574defines an overridable copying operation for all the objects you care
575about. (One practical point: it would have to be a built-in function,
576not a standard method name, since not all built-in object types have
577methods; e.g. strings, integers and tuples don't.)
578
5796.2. Q. Why isn't there a generic way to implement persistent objects
580in Python? (Persistent == automatically saved to and restored from
581disk.)
582
583A. Hmm, hmm. Basically for the same reasons as why there is no
584generic copying operation.
585
5866.3. Q. Why isn't there a switch or case statement in Python?
587
588A. You can do this easily enough with a sequence of
589if... elif... elif... else. There have been some proposals for switch
590statement syntax, but there is no concensus (yet) on whether and how
591to do range tests.
592
593
5947. Using Python on non-UNIX platforms
595=====================================
596
Guido van Rossum95f61a71994-01-26 17:23:37 +00005977.1. Q. Where's the DOS version of 1.0.0?
Guido van Rossuma7925f11994-01-26 10:20:16 +0000598
Guido van Rossum95f61a71994-01-26 17:23:37 +0000599A. I hope it will be coming soon. Our institute has finally acquired
600a 486 PC with a decent C compiler, now all I have to do is to learn
601how to use it :-) Until then, you will have to make do with the 0.9.8
602version (which isn't so bad, actually).
Guido van Rossuma7925f11994-01-26 10:20:16 +0000603
6047.2. Q. Is there a Windows version of Python?
605
606A. Not yet. Several Windows hackers with C compilers are working on a
607port though, so maybe we'll have one soon.
608
6097.3. Q. I have the Mac or DOS version but it appears to be only a binary.
610Where's the library?
611
612A. You still need to copy the files from the distribution directory
613"python/lib" to your system. If you don't have the full distribution,
Guido van Rossum95f61a71994-01-26 17:23:37 +0000614you can ftp the file pythonlib1.0.0.tar.Z from site ftp.cwi.nl,
Guido van Rossuma7925f11994-01-26 10:20:16 +0000615directory /pub/python; this is a subset of the distribution containing
616just those file.
617
6187.4. Q. Where's the documentation for the Mac or DOS version?
619
620A. There isn't any. The documentation for the Unix version also
621applies to the Mac and DOS versions. Where applicable, differences
622are indicated in the text.
623
6247.5. Q. The Mac version doesn't seem to have any facilities for creating or
625editing programs apart from entering it interactively, and there seems
626to be no way to save code that was entered interactively. How do I
627create a Python program on the Mac?
628
629A. Use an external editor. I am quite happy with the Desk Accessory
630called Sigma Edit; this doesn't require Multifinder or System 7. I
631work like this: start the interpreter; edit a module file using Sigma
632Edit; import and test it in the interpreter; edit again in Sigma Edit;
633then use the built-in function reload() to re-read the imported
634module; etc.