Added a section to the chapter on modules, describing the package system.
The text is almost completely from GvR's essay on packages; some
introductory paragraphs have been removed, and everything after the
'Details' section in the HTML has been dropped (seems too technical). A
paragraph has been added after the sample package layout stating that there
must be a file called__init__.py in a directory to make it a package.
Guido van Rossum [Mon, 29 Jun 1998 23:17:16 +0000 (23:17 +0000)]
Fix by Sjoerd Mullender to support symbolic links and make a backup of
.mirrorinfo. Fix by me to call string.lstrip(filename) to cope with a
bug in strop.strip() in Python 1.4. Additionally, I changed all print
statements that print filenames etc. to put them in backquotes so that
it will be more obvious when there's a funny character on one of them
(such as a space...).
Guido van Rossum [Mon, 29 Jun 1998 20:32:57 +0000 (20:32 +0000)]
For completeness, add a dummy load_package() method to RHooks. It
should never be called, so this isn't really needed, but this
signifies that rexec now supports packages -- because ihooks does.
Guido van Rossum [Mon, 29 Jun 1998 20:29:08 +0000 (20:29 +0000)]
Added findall() to RegexObject -- return a list of all matches in a
string. Added groupdict() to MatchObject -- return the named groups
as a dict. Added default argument to groups() to specify what to
return for unmatching groups; groupdict() also has this.
Guido van Rossum [Sat, 27 Jun 1998 21:53:17 +0000 (21:53 +0000)]
Windows-specific hack to make sure that when LoadLibrary() is called,
the filename contains at least a rudimentary pathname.
(The bad part is that we need to call getcwd() because only a prefix
of ".\\" is not enough -- we prefix the drive letter.)
Guido van Rossum [Sat, 27 Jun 1998 18:25:44 +0000 (18:25 +0000)]
Document optional kwargs argument to start_new_thread(). Also
document new LockType and reverse the preference for exit()
vs. exit_thread() -- exit() is now preferred and exit_thread() is
obsolete.
Jack Jansen [Fri, 26 Jun 1998 14:56:00 +0000 (14:56 +0000)]
Mac version of freeze. Uses standard freeze modules where it can,
augmenting them here and there. For now, it works more-or-less similar
to unix/windows freeze, generating a config.c file, but storing
modules in PYC resources. A template project is also copied.
The hooks are in place to freeze by merging shared libraries so you
can freeze without a C compiler/linker, but this does not work yet.
Guido van Rossum [Tue, 23 Jun 1998 19:31:19 +0000 (19:31 +0000)]
Subsume the interact() function in a class. This should make it
possible to use this in PythonWin, and to replace Fredrik Lundh's
PythonInterpreter class. Fredrik is credited with the class' API.
Guido van Rossum [Mon, 22 Jun 1998 14:07:36 +0000 (14:07 +0000)]
Revert the change of revision 1.30. While it's in general a laudable
goal to use isinstance(x, y) instead of comparing type(x) to y, it
doesn't make sense to change this in the example code for the type()
builtin...
Guido van Rossum [Mon, 22 Jun 1998 03:54:15 +0000 (03:54 +0000)]
Fix the tests for various anomalies in the string-to-numbers
conversions. Formerly, for example, int('-') would return 0 instead
of raising ValueError, and int(' 0') would raise ValueError
(complaining about a null byte!) instead of 0...
Guido van Rossum [Fri, 19 Jun 1998 04:35:45 +0000 (04:35 +0000)]
Turns out that 'winfo id' returns the id as a hex string, with 0x prefix.
The int() function (aliased to getint()) doesn't handle that, so we must
use self.tk.getint() again...
Guido van Rossum [Fri, 19 Jun 1998 04:28:10 +0000 (04:28 +0000)]
There was an error check in a loop in PythonCmd which called
PythonCmd_Error() but failed to return. The error wasn't very likely
(only when we run out of memory) but since the check is there we might
as well return the error. (I think that Barry introduced this buglet
when he added error checks everywhere.)
Guido van Rossum [Wed, 17 Jun 1998 22:37:26 +0000 (22:37 +0000)]
Documented that by default the output goes to stderr, and that a file
keyword argument can be used to direct it somewhere else. Also
documented all the other functions in this module, and even added a
little example.
# Haven't tested the latex for correctness -- all latex installations
# appear broken.
Guido van Rossum [Wed, 17 Jun 1998 18:34:40 +0000 (18:34 +0000)]
In class _Subfile, make sure read(n) can't read beyond EOF. Also
allow negative numbers to specify read until EOF (like for a regular
file's read() method).
Guido van Rossum [Wed, 17 Jun 1998 15:16:40 +0000 (15:16 +0000)]
Change the description of input() -- it is exactly equivalent to
eval(raw_input(s)). The statement about breaking a long expression
over multiple lines is no longer true.
Guido van Rossum [Wed, 17 Jun 1998 14:15:44 +0000 (14:15 +0000)]
Minor cleanup by Tim after my changes:
+ Took the "list" argument out of the other functions that no longer need
it. This speeds things up a little more.
+ Small comment changes in accord with that.
+ Exploited the now-safe ability to cache values in the partitioning loop.
Makes no timing difference on my flavor of Pentium, but this machine ran out
of registers 12 iterations ago. It should yield a small speedup on a RISC
machine, and not hurt in any case.
Guido van Rossum [Tue, 16 Jun 1998 15:18:28 +0000 (15:18 +0000)]
Tim's latest, with some of my changes (also a TP suggestion) added:
instead of testing whether the list changed size after each
comparison, temporarily set the type of the list to an immutable list
type. This should allow continued use of the list for legitimate
purposes but disallows all operations that can change it in any way.
(Changes to the internals of list items are not caught, of cause;
that's not possible to detect, and it's not necessary to protect the
sort code, either.)