annotate Mac/Relnotes-1.1 @ 4566:6403c94de50d legacy-trunk

Added safeguard against failure in __del__.
author Guido van Rossum <guido@python.org>
date Wed, 27 Nov 1996 19:39:58 +0000
parents ea5b13d11a13
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1615
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
1 PYTHON RELEASE NOTES FOR THE MACINTOSH
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
2
1811
ea5b13d11a13 Added macmain.c (separate Mac specific main prog); bump version to 1.1
Guido van Rossum <guido@python.org>
parents: 1648
diff changeset
3 VERSION 1.1
1615
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
4
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
5 For the most part, Python on the Mac works just like Python under UNIX.
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
6 The most important differences are:
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
7
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
8 - Since there is no shell environment on the Mac, the start-up file
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
9 has a fixed name: PythonStartup. If a file by this name exists
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
10 (either in the current folder or in the system folder) it is executed
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
11 when an interactive interpreter is started.
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
12
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
13 - The default search path for modules is different: first the current
1648
7ac4e49791f4 Removed some random ^D characters
Guido van Rossum <guido@python.org>
parents: 1615
diff changeset
14 directory is searched, then the subdirectories 'lib', 'lib:stdwin' and
1615
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
15 'demo'. As always, you can change this (e.g. in your PythonStartup
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
16 file) by assigning or appending to sys.path -- use Macintosh pathnames!
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
17 (The default contains no absolute paths because these are unlikely
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
18 to make sense on other people's hard disks.)
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
19
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
20 - The user interface for typing interactive commands is different.
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
21 This is actually the THINK C console I/O module, which is based on
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
22 the Mac toolbox TextEdit. A standard Edit menu provides Cut, Copy,
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
23 Paste and Clear (Undo is only there for Desk Accessories). A minimal
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
24 File menu provides Quit, which immediately exits the application,
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
25 without the usual cleanup. You can Copy from previous output,
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
26 but you can't scroll back beyond the 24x80 screen. The TAB key
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
27 always brings you to the end of the current input line; indentation
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
28 must be entered with spaces (a single space is enough).
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
29 End-of-file is generated by Command-D; Command-Period interrupts.
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
30 There is an annoying limit in the length of an input line to a single
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
31 screen line (less the prompt). Use \ to input long statements.
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
32 Change your program if it requires long lines typed on input.
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
33 Even though there is no resize box, the window can be resized by
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
34 dragging its bottom right corner, but the maximum size is 24x80.
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
35
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
36 - Tabs in module files are interpreted as 4 (four!) spaces. This is
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
37 consistent with most Mac editors that I know. For individual files
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
38 you can change the tab size with a comment like
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
39
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
40 # vi:set tabsize=8:
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
41
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
42 (exactly as shown here, including the colons!). If you are consistent
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
43 in always using tabs for indentation on UNIX, your files will be
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
44 parsed correctly on the Mac, although they may look funny if you
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
45 have nicely lined-up comments or tables using tabs. Never using tabs
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
46 also works. Mixing tabs and spaces to simulate 4-character indentation
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
47 levels is likely to fail.
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
48
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
49 - You can start a script from the Finder by selecting the script and
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
50 the Python interpreter together and then double clicking. If you
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
51 make the owner of the script PYTH (the type should always be TEXT)
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
52 Python will be launched if you double click it!
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
53 There is no way to pass command line arguments to Python scripts.
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
54
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
55 - The set of built-in modules is different:
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
56
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
57 = Operating system functions for the 'os' module is provided by the
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
58 built-in module 'mac', not 'posix'. This doesn't have all the
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
59 functions from posix, for obvious reasons (if you know the Mac
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
60 O/S a little bit). The functions in os.path are provided by
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
61 macpath, they know about Mac pathnames etc.
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
62
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
63 = None of the UNIX specific modules ('socket', 'pwd', 'grp' etc.)
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
64 exists.
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
65
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
66 = Module 'stdwin' is always available. It uses the Mac version of
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
67 STDWIN, which interfaces directly with the Mac toolbox. The most
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
68 important difference is in the font names; setfont() has a second
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
69 argument specifying the point size and an optional third one
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
70 specifying the variation: a single letter character string,
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
71 'i' for italics, 'b' for bold. Note that when STDWIN is waiting
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
72 for events, the standard File and Edit menus are inactive but
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
73 still visible, and (most annoyingly) the Apple menu is also inactive;
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
74 conversely, menus put up by STDWIN are not active when the Python is
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
75 reading from the keyboard. If you open Python together with a text
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
76 file containing a Python script, the script will be executed and
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
77 a console window is only generated when the script uses standard
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
78 input or output. A script that uses STDWIN exclusively for its I/O
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
79 will have a working Apple menu and no extraneous File/Edit menus.
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
80 (This is because both stdwin and stdio try to initialize the
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
81 windowing environment; whoever gets there first owns the Apple menu.)
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
82 LIMITATIONS: a few recent additions to STDWIN for X11 have not yet
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
83 been added to the Mac version. There are no bitmap objects, and
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
84 the setwinpos() and setwinsize() methods are non--functional.
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
85
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
86 - Because launching an application on the Mac is so tedious, you will
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
87 want to edit your program with a desk accessory editor (e.g., Sigma
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
88 edit) and test the changed version without leaving Python. This is
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
89 possible but requires some care. Make sure the program is a module
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
90 file (filename must be a Python identifier followed by '.py'). You
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
91 can then import it when you test it for the first time. There are
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
92 now three possibilities: it contains a syntax error; it gets a runtime
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
93 error (unhandled exception); or it runs OK but gives wrong results.
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
94 (If it gives correct results, you are done testing and don't need
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
95 to read the rest of this paragraph. :-) Note that the following
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
96 is not Mac-specific -- it's just that on UNIX it's easier to restart
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
97 the entire script so it's rarely useful.
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
98
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
99 Recovery from a syntax error is easy: edit the file and import it
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
100 again.
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
101
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
102 Recovery from wrong output is almost as easy: edit the file and,
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
103 instead of importing it, call the function reload() with the module
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
104 name as argument (e.g., if your module is called foo, type
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
105 "reload(foo)").
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
106
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
107 Recovery from an exception is trickier. Once the syntax is correct,
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
108 a 'module' entry is placed in an internal table, and following import
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
109 statements will not re-read the file, even if the module's initialization
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
110 terminated with an error (one reason why this is done is so that
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
111 mutually recursive modules are initialized only once). You must
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
112 therefore force re-reading the module with reload(), however, if this
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
113 happens the first time you try to import the module, the import statement
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
114 itself has not completed, and your workspace does not know the module
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
115 name (even though the internal table of moduesl does!). The trick is
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
116 to first import the module again, then reload it. For instance,
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
117 "import foo; reload(foo)". Because the module object already exists
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
118 internally, the import statement does not attempt to execute the
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
119 module again -- it just places it in your workspace.
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
120
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
121 When you edit a module you don't have to worry about the corresponding
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
122 '.pyc' file (a "compiled" version of the module, which loads much faster
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
123 than the textual version): the interpreter notices that the '.py' file
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
124 has changed (because its modification time has changed) and ignores the
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
125 '.pyc' file. When parsing is successful, a new '.pyc' file is written;
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
126 if this fails (no write permission, disk full or whatever) it is
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
127 silently skipped but attempted again the next time the same module
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
128 is loaded. (Thus, if you plan to place a Python library on a read-only
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
129 disk, it is advisable to "warm the cache" by making the disk writable
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
130 and importing all modules once. The standard module 'importall' helps
f50fe4b952ba Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
131 in doing this.)