Commit Graph

83 Commits

Author SHA1 Message Date
Tim Peters 8f01b680c8 Change Windows file.truncate() to (a) restore the original file position,
and (b) stop trying to prevent file growth.

Beef up the file.truncate() docs.

Change test_largefile.py to stop assuming that f.truncate() moves the
file pointer to the truncation point, and to verify instead that it leaves
the file position alone.  Remove the test for what happens when a
specified size exceeds the original file size (it's ill-defined, according
to the Single Unix Spec).
2002-03-12 03:04:44 +00:00
Tim Peters fb05db2cae file_truncate(): provide full "large file" support on Windows, by
dropping MS's inadequate _chsize() function.  This was inspired by
SF patch 498109 ("fileobject truncate support for win32"), which I
rejected.

libstdtypes.tex:  Someone who knows should update the availability
blurb.  For example, if it's available on Linux, it would be good to
say so.

test_largefile:  Uncommented the file.truncate() tests, and reworked to
do more.  The old comment about "permission errors" in the truncation
tests under Windows was almost certainly due to that the file wasn't open
for *write* access at this point, so of course MS wouldn't let you
truncate it.  I'd be appalled if a Unixish system did.

CAUTION:  Someone should run this test on Linux (etc) too.  The
truncation part was commented out before.  Note that test_largefile isn't
run by default.
2002-03-11 00:24:00 +00:00
Fred Drake ab2dc1d730 Added index entries similar to some recommended by Skip, and used the word
"interpolation" in the text, to make the string formatting material easier to
find.
This closes SF bug #487165.
Bugfix: this should be applied for Python 2.2.1.
2001-12-26 20:06:40 +00:00
Fred Drake 6048ce95a9 Added documentation for str.decode().
This closes SF bug #490823.
2001-12-10 16:43:08 +00:00
Fred Drake b38784e4a0 Slightly improved indexing for the string-% operator, thanks to comments
from Skip Montanaro.  There is one weirdness in the final index for HTML, but
that is low priority.
2001-12-03 22:15:56 +00:00
Fred Drake 14f5c5fa01 Make no assumption about how modules are built when referring to them; this
can vary by platform and installation.
Based on suggestion to python-docs.
2001-12-03 18:33:13 +00:00
Fred Drake 3570551d6f Remove most references to __members__ and __methods__, leaving only one pair
of references that now state that these attributes have been removed,
directing the reader to the dir() function.
This closes SF bug #456420.
2001-12-03 17:32:27 +00:00
Fred Drake c37b65ee10 Clean up some markup cruft. A number of the macros that take no
parameters (like \UNIX) are commonly entered using an empty group to
separate the markup from a following inter-word space; this is not
needed when the next character is punctuation, or the markup is the
last thing in the enclosing group.  These cases were marked
inconsistently; the empty group is now *only* used when needed.
2001-11-28 07:26:15 +00:00
Fred Drake 99de218cfc Promote file objects out of the "Other Objects" category, so they become
visible in the table of contents.
2001-10-30 06:23:14 +00:00
Tim Peters 003047a5f2 Mention the new file() builtin in the section on file objects. 2001-10-30 05:54:04 +00:00
Fred Drake ef428a292a Explain what [].insert() does when the target index is negative. 2001-10-26 18:57:14 +00:00
Fred Drake 0aa811c527 Use the \note and \warning macros where appropriate. 2001-10-20 04:24:09 +00:00
Tim Peters 599db7de63 The list.sort() docs require a function that returns -1, 0 or +1. That's
never been true, and in particular implies cmp() can't be used(!).  Get
closer to the truth.
2001-09-29 01:08:19 +00:00
Tim Peters 2c9aa5ea8d Generalize file.writelines() to allow iterable objects. 2001-09-23 04:06:05 +00:00
Fred Drake 038d26410d Note that files are iterable; describe what the iterator returns.
This closes SF bug #463738.
2001-09-22 04:34:48 +00:00
Fred Drake d800cff80d Added explanation that [...] * n generates shallow copies of [...], so
the contents will be shared by multiple references.

This closes SF bug #455694.
2001-08-28 14:56:05 +00:00
Barry Warsaw 5ef99a0bc5 Describe the new semantics for setting and deleting a function's
__dict__ attribute.  Deleting it, or setting it to a non-dictionary
result in a TypeError.  Note that getting it the first time magically
initializes it to an empty dict so that func.__dict__ will always
appear to be a dictionary (never None).

Closes SF bug #446645.
2001-08-14 18:22:24 +00:00
Greg Ward 54f65094c3 Typo fix. 2001-07-26 21:01:21 +00:00
Skip Montanaro 41d7d58cc4 trivial rewording in footnote 5. 2001-07-25 16:18:19 +00:00
Fred Drake 907e76b620 Fix up a few style nits -- avoid "e.g." and "i.e." -- these make
translation more difficult, as well as reading the English more
difficult for non-native speakers.
2001-07-06 20:30:11 +00:00
Guido van Rossum 5fe2c139d5 List constraints on xrange() objects. 2001-07-05 15:27:19 +00:00
Guido van Rossum 3f56166b1a Rip out the fancy behaviors of xrange that nobody uses: repeat, slice,
contains, tolist(), and the start/stop/step attributes.  This includes
removing the 4th ('repeat') argument to PyRange_New().
2001-07-05 13:27:48 +00:00
Barry Warsaw e9218a1a8e Remove the restriction on a mapping's .update() method. 2001-06-26 20:32:59 +00:00
Fred Drake 4a6c5c568f Fixed reference to table notes for {}.keys() and {}.items() -- these
references did not get updated when the notes were renumbered in a
previous update.

This fixes SF bug #432208.
2001-06-12 03:31:56 +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 f42cc45f1b The general iteration support is part of 2.2, not 2.1 -- fixed the version
annotations!

Also fixed a typo noted by Neil S.
2001-05-03 04:39:10 +00:00
Fred Drake 93656e76f9 Added section describing the iterator protocol. 2001-05-02 20:18:03 +00:00
Guido van Rossum 8b3d6ca3df At the suggestion of Peter Funk, document 'key in dict' and 'key not
in dict' after has_key(), with a \versionadded{2.2} note.
2001-04-23 13:22:59 +00:00
Fred Drake 82f93c693d Only document <file>.xreadlines() once; added version annotation.
This closes SF bug #417943.
2001-04-22 01:56:51 +00:00
Fred Drake 4cacec5393 Fix a number of minor markup errors. 2001-04-21 05:56:06 +00:00
Guido van Rossum 0dbb4fba4c Implement, test and document "key in dict" and "key not in dict".
I know some people don't like this -- if it's really controversial,
I'll take it out again.  (If it's only Alex Martelli who doesn't like
it, that doesn't count as "real controversial" though. :-)

That's why this is a separate checkin from the iterators stuff I'm
about to check in next.
2001-04-20 16:50:40 +00:00
Barry Warsaw d4614e8371 Updates to the semantics of function and method attributes. 2001-02-27 03:32:35 +00:00
Fred Drake 8c071d4388 Massively improved documentation for string formatting operations,
primarily from Evelyn Mitchell (thanks!).

This closes SF patch #103412.
2001-01-26 20:48:35 +00:00
Guido van Rossum 20ab9e9c0a Document xreadlines() method. (Forgot to check this in before!) 2001-01-17 01:18:00 +00:00
Barry Warsaw 83ad5015cb effbot caught a typo! 2001-01-15 20:51:40 +00:00
Barry Warsaw 773d9f09be Document function attributes for both the function type and the method
type.  The method documentation also includes a new brief discussion
of `bound' vs. `unbound' and why setting an attr on a bound method is
a TypeError.  Includes Skip's suggested text.
2001-01-15 20:28:50 +00:00
Fred Drake 3c48ef7de8 Added documentation for the xreadlines module & related changes. The
documentation was written by Jeff Epler (thanks!).
2001-01-09 22:47:46 +00:00
Fred Drake 19ae78302e Added information about the interaction of opening a file in append mode
and seek() in the description of seek().

This closes SF bug #126850.
2001-01-04 05:16:39 +00:00
Guido van Rossum ff63f2023d "Documentation" for {}.popitem(). 2000-12-12 22:03:47 +00:00
Moshe Zadka 5725d1eb03 Backing out my changes.
Improved version coming soon to a Source Forge near you!
2000-11-30 19:30:21 +00:00
Moshe Zadka 1a62750eda Added .first{item,value,key}() to dictionaries.
Complete with docos and tests.
OKed by Guido.
2000-11-30 12:31:03 +00:00
Fred Drake 17383b9ad7 Added information about the %r string formatting conversion. Added note
about the interpretation of radix 0 for int(), and added description of
the optional radix argument for long().  Based on comments from Reuben
Sumner <rasumner@users.sourceforge.net>.

This closes bug #121672.
2000-11-17 19:44:14 +00:00
Fred Drake a776cea71a Document the proper exception to be raised by I/O operations on closed
files; error reported by Ng Pheng Siong <ngps@post1.com>.

Make sure that various special object attributes are properly indexed.
2000-11-06 20:17:37 +00:00
Fred Drake 1dba66cb72 Marc-Andre Lemburg <mal@lemburg.com> noted that the encode() string method
was added in 2.0.
2000-10-25 21:03:55 +00:00
Fred Drake 0b4e25d0c0 Use \obindex{...} instead of \indexii{...}{type} in many places; this is
more consistent with other index entries in the documentation.
2000-10-04 04:21:19 +00:00
Fred Drake fffe5dbc47 Fixed a number of small problems reported by Detlef Lannert
<lannert@uni-duesseldorf.de>.
2000-09-21 05:25:30 +00:00
Fred Drake 51f53df4c8 Clarify that the softspace attribute is used by print for state management,
not as a user-controlled parameter.
2000-09-20 04:48:20 +00:00
Fred Drake 752ba39a0b Clarify a number of issues about the file-like object API based on
discussion on python-dev.
2000-09-19 15:18:51 +00:00
Fred Drake d5d0435617 Use \shortversion in a number of places.
This partially addresses SourceForge bug #114318.
2000-09-14 20:24:17 +00:00
Fred Drake 66d32b1e12 Add some index entries to make it easier to find information on
%-formatting of strings.
2000-09-14 17:57:42 +00:00