Commit Graph

3893 Commits

Author SHA1 Message Date
Tim Peters 7a3bfc3a47 Added q/Q standard (x-platform 8-byte ints) mode in struct module.
This completes the q/Q project.

longobject.c _PyLong_AsByteArray:  The original code had a gross bug:
the most-significant Python digit doesn't necessarily have SHIFT
significant bits, and you really need to count how many copies of the sign
bit it has else spurious overflow errors result.

test_struct.py:  This now does exhaustive std q/Q testing at, and on both
sides of, all relevant power-of-2 boundaries, both positive and negative.

NEWS:  Added brief dict news while I was at it.
2001-06-12 01:22:22 +00:00
Fred Drake 0b9bc20e66 Add the appropriate availability annotations for the popen*() family of
functions -- these are not available on traditional Mac OS platforms.

Corrected the version annotations for the spawn*() functions and related
constants; these were added in Python 1.6, not 1.5.2.
2001-06-11 18:25:34 +00:00
Fred Drake 046f4d810d Fixed parameter order for os.popen2(), os.popen3(), and os.popen(4). Added
a reference to these functions and popen() from the "Process Management"
section.

Based on a suggestion from comp.lang.python.
2001-06-11 15:21:48 +00:00
Fred Drake c115835457 Fix recent changes so that this section will format again. 2001-06-11 14:55:01 +00:00
Tim Peters 7b9542a3f7 Initial support for 'q' and 'Q' struct format codes: for now, only in
native mode, and only when config #defines HAVE_LONG_LONG.  Standard mode
will eventually treat them as 8-byte ints across all platforms, but that
likely requires a new set of routines in longobject.c first (while
sizeof(long) >= 4 is guaranteed by C, there's nothing in C we can rely
on x-platform to hold 8 bytes of int, so we'll have to roll our own;
I'm thinking of a simple pair of conversion functions, Python long
to/from sized vector of unsigned bytes; that may be useful for GMP
conversions too; std q/Q would call them with size fixed at 8).

test_struct.py:  In addition to adding some native-mode 'q' and 'Q' tests,
got rid of unused code, and repaired a non-portable assumption about
native sizeof(short) (it isn't 2 on some Cray boxes).

libstruct.tex:  In addition to adding a bit of 'q'/'Q' docs (more needed
later), removed an erroneous footnote about 'I' behavior.
2001-06-10 23:40:19 +00:00
Fred Drake 7bc50714fe Fix the attributions for the new floating point text. 2001-06-08 17:09:01 +00:00
Fred Drake 8c27d99941 Added credits in the right places. 2001-06-08 16:28:53 +00:00
Fred Drake 417d667dd9 Text from Tim & Guido discussing floating point arithmetic and what users
need to understand about the binary & decimal fp, so that representation
weirdness is documented somewhere.  This makes it easier to repond to "bug"
reports caused by user confusion & ignorance of the issues.

This closes SF patch #426208.
2001-06-08 16:24:58 +00:00
Skip Montanaro 1dc98c44fe add warning about situation where code may be executed twice, once when
module is __main__ and once when module is imported.
2001-06-08 14:40:28 +00:00
Fred Drake 62f9d7c021 In the section on extending the profiler, add some additional discussion
about setting up the dispatch table, and update the OldProfile and
HotProfile classes to the current implementations, showing the adjusted
construction for the dispatch table.
2001-06-08 05:04:19 +00:00
Martin v. Löwis e2ccb89513 Document filter. 2001-06-07 19:01:24 +00:00
Fred Drake 2a9bda9223 Typo: "descrition" --> "description"
Add reference to the documentation for the Python documentation markup.

Fixed up a couple of descriptions.

This closes SF bug #430627.
2001-06-06 16:02:47 +00:00
Fred Drake 9ccc0df52f Add references to the documentation for the Python documentation markup.
Suggested by the comments in SF bug #430627.
2001-06-06 15:59:04 +00:00
Martin v. Löwis e24fef0dd2 Fix bug #422702: Make flag argument to open optional, and document it that way. 2001-06-05 05:33:19 +00:00
Fred Drake 88382696f4 Update a "Programmer's note" about lambda forms and scoping to reflect
the availability of nested scoping in Python 2.1 and 2.2.
2001-06-05 02:17:02 +00:00
Skip Montanaro b9d973dac5 is -> if in rename description 2001-06-04 15:31:17 +00:00
Fred Drake 00d0cb6ec3 Explained more differences between PyList_SetItem() and PyList_SET_ITEM().
In particular, the affect on existing list content was not sufficiently
explained.

This closes SF bug #429554.
2001-06-03 03:12:57 +00:00
Fred Drake 81e142b907 Document os.getenv().
This closes SF bug #429059.
2001-05-31 20:27:46 +00:00
Fred Drake c19f39272e Some general cleanup of the threading module documentation, including
fixing the reference to Thread.getDeamon() (should be isDaemon()).

This closes SF bug #429070.
2001-05-31 20:24:07 +00:00
Fred Drake 6cba3d0e64 Added entry for HTMLParser documentation. 2001-05-30 04:59:50 +00:00
Fred Drake 3b755d43ac Michel Pelletier <michel@digicool.com>:
Documentation for the HTMLParser module, with small changes by FLD.
2001-05-30 04:59:00 +00:00
Fred Drake 9a374186fc New solution to the "Someone stuck a colon in that filename!" problem:
Allow colons in the labels used for internal references, but do not
expose them when generating filename.
2001-05-29 19:53:46 +00:00
Fred Drake 96a2a80065 Users of PySequence_GET_FAST() should get the length of the sequence using
PySequence_Size(), not PyObject_Size(): the later considers the mapping
methods as well as the sequence methods, which is not needed here.  Either
should be equally fast in this case, but PySequence_Size() offers a better
conceptual match.
2001-05-29 18:51:41 +00:00
Fred Drake dc9e7e42c8 readlink() description: Added note that the return value may be either
absolute or relative.

remove(), rename() descriptions:  Give more information about the cross-
    platform behavior of these functions, so single-platform developers
    can be aware of the potential issues when writing portable code.

This closes SF patch #426598.
2001-05-29 18:13:06 +00:00
Fred Drake 964c074a62 Hack to make this play nicer with *old* versions of Python: os.path.abspath()
was not available in Python 1.5.1.  (Yes, a user actually tried to use this
with that version of Python!)
2001-05-29 16:10:07 +00:00
Fred Drake 597bc1d46f Bring the notes on the relationship between __cmp__(), __eq__(), and
__hash__() up to date (re: use of objects which define these methods
as dictionary keys).

This closes SF bug #427698.
2001-05-29 16:02:35 +00:00
Fred Drake b9879e1020 Fix typo reported in SF bug #427783. 2001-05-29 15:44:27 +00:00
Fred Drake c80d4dd695 The parameter to the listen() method is not optional, but was marked as
optional in the documentation.

This closes SF bug #427985.
2001-05-29 15:37:45 +00:00
Fred Drake b2625eb10e Removed information on the old third parameter to _PyTuple_Resize().
Added information on PyIter_Check(), PyIter_Next(),
PyObject_Unicode(), PyString_AsDecodedObject(),
PyString_AsEncodedObject(), and PyThreadState_GetDict().
2001-05-29 15:34:06 +00:00
Fred Drake 404ac97207 If the input line does not contain enough fields, raise a meaningful
error.
2001-05-29 15:25:51 +00:00
Fred Drake fac312ff88 Do not start API descriptions with "Does the same, but ..." -- actually
state *which* other function the current one is like, even if the
descriptions are adjacent.

Revise the _PyTuple_Resize() description to reflect the removal of the
third parameter.
2001-05-29 15:13:00 +00:00
Fred Drake 56a71eee65 Add a version annotation for splitdrive(); old, but as long as I managed
to end up with the information, it is better recorded than lost.
2001-05-25 16:21:00 +00:00
Fred Drake c6d8f8d2ac Add descriptions of {}.iteritems(), {}.iterkeys(), and {}.itervalues()
in the table of mapping object operations.  Re-numbered the list of
notes to reflect the move of the "Added in version 2.2." note to the list
of notes instead of being inserted into the last column of the table.
2001-05-25 04:24:37 +00:00
Fred Drake 98cfab6523 One more update related to the new get() and setdefault() methods on the
Message object.
2001-05-22 22:00:40 +00:00
Fred Drake 6b4593e338 Update to add get() and setdefault() as supported mapping operations, and
add a list of the mapping methods which are not supported (per Barry's
comments).
2001-05-22 15:12:46 +00:00
Fred Drake 706314909b Add some clarifications about the mapping interface presented by
rfc822.Message objects, based on comments from Barry.
2001-05-22 14:36:30 +00:00
Tim Peters bd695a716d Changed all the examples with ugly platform-dependent float output to use
numbers that display nicely after repr().  From much doctest experience
with the same trick, I believe people find examples with simple fractions
easier to understand too:  they can usually check the results in their
head, and so feel confident about what they're seeing.  Not even I get a
warm feeling from a result that looks like 70330.345024097141 ...
2001-05-22 06:54:14 +00:00
Fred Drake 1400baa5d6 Add a "See also" section with useful links. More should be added giving
pointers to information about the other mailbox formats; if anyone can
provide the information needed, please let me know!
2001-05-21 21:23:01 +00:00
Fred Drake 8b0b8409ae Update output to reflect additional precision produced by the repr() of
floating point numbers in an interactive example.


Added comment to help explain control flow in the example code showing
how to check if a number is prime.

This closes SF bugs 419434 and 424552.
2001-05-21 16:55:39 +00:00
Fred Drake 24e621918b Add documentation for Py_Main() and PyThreadState_GetDict(). 2001-05-21 15:56:55 +00:00
Fred Drake fc43d00c17 Typo: "that" --> "than"
This closes SF bug #425320.
2001-05-21 15:03:35 +00:00
Fred Drake e9719fe1a7 Fix bug in smtplib example: the prompt said to end the message with ^D,
but doing so raised EOFError.  This makes it work as advertised and
converts to string methods where reasonable.

This closes SF bug #424776.
2001-05-20 12:26:04 +00:00
Fred Drake 09daff4596 Get Aahz listed correctly using his legal/professional name. 2001-05-20 05:29:01 +00:00
Andrew M. Kuchling 3b923fcff5 Add another item 2001-05-19 19:35:46 +00:00
Fred Drake c0dac1a58c Beef up the unicode() description a bit, based on material from AMK's
"What's New in Python ..." documents.
2001-05-15 15:27:53 +00:00
Marc-André Lemburg 2d9204199f This patch changes the way the string .encode() method works slightly
and introduces a new method .decode().

The major change is that strg.encode() will no longer try to convert
Unicode returns from the codec into a string, but instead pass along
the Unicode object as-is. The same is now true for all other codec
return types. The underlying C APIs were changed accordingly.

Note that even though this does have the potential of breaking
existing code, the chances are low since conversion from Unicode
previously took place using the default encoding which is normally
set to ASCII rendering this auto-conversion mechanism useless for
most Unicode encodings.

The good news is that you can now use .encode() and .decode() with
much greater ease and that the door was opened for better accessibility
of the builtin codecs.

As demonstration of the new feature, the patch includes a few new
codecs which allow string to string encoding and decoding (rot13,
hex, zip, uu, base64).

Written by Marc-Andre Lemburg. Copyright assigned to the PSF.
2001-05-15 12:00:02 +00:00
Fred Drake b3384d3555 Make sure we include all of Python's numeric types in the data model
description, so that the introduction of complex is not a surprise.

This closes SF bug #423429.
2001-05-14 16:04:22 +00:00
Fred Drake ba7e2c8a27 Add some text to make the dircmp object section more readable, and move
some stuff around.
2001-05-11 17:01:32 +00:00
Fred Drake 886f113ba9 --sigh--
Finish the last set of changes to these files so the conversion does not
break.
2001-05-11 15:49:19 +00:00
Fred Drake 47852467f5 Markup adjustments to avoid getting junk in the index. 2001-05-11 15:46:45 +00:00