Commit Graph

165 Commits

Author SHA1 Message Date
Raymond Hettinger d918884bb8 Fix typo 2002-09-04 23:52:42 +00:00
Fred Drake 5ec486b87a Add a note that apply() is needed since the extended call syntax is
completely equivalent.
2002-08-22 14:27:35 +00:00
Guido van Rossum 45ec02aed1 SF patch 576101, by Oren Tirosh: alternative implementation of
interning.  I modified Oren's patch significantly, but the basic idea
and most of the implementation is unchanged.  Interned strings created
with PyString_InternInPlace() are now mortal, and you must keep a
reference to the resulting string around; use the new function
PyString_InternImmortal() to create immortal interned strings.
2002-08-19 21:43:18 +00:00
Fred Drake 2095b9690f reduce(): Clarified what is returned in the case of a sequence 1 item long and
initial/default value.
2002-07-17 13:55:33 +00:00
Fred Drake 4254cbd29c Note that unicode() can raise LookupError for unknown codecs.
Closes SF bug #513666.
2002-07-09 05:25:46 +00:00
Fred Drake 50e1286c00 Fix typo: "an Unicode string" --> "a Unicode string"
Clarify the return value when the parameter is a Unicode object.
2002-07-08 14:29:05 +00:00
Fred Drake 78e057a32a Clarify the version information for the unicode() built-in.
Closes SF bug #575272.
2002-06-29 16:06:47 +00:00
Fred Drake 807354f3b6 Add a note that divmod() with complex numbers is deprecated. 2002-06-20 21:10:25 +00:00
Barry Warsaw 177b4a065f Jack's documentation for the U mode character on the file()
constructor, vetted by Barry.
2002-05-22 20:39:43 +00:00
Raymond Hettinger 6cf09f0792 Patch 543387. Document deprecation of complex %, //,and divmod(). 2002-05-21 18:19:49 +00:00
Fred Drake 38f71973e5 Documentation for the enumerate() function/type.
This closes SF patch #547162.
2002-04-26 20:29:44 +00:00
Fred Drake 933f159a2f Add a version annotation for the help() function. 2002-04-17 12:54:04 +00:00
Guido van Rossum 77f6a65eb0 Add the 'bool' type and its values 'False' and 'True', as described in
PEP 285.  Everything described in the PEP is here, and there is even
some documentation.  I had to fix 12 unit tests; all but one of these
were printing Boolean outcomes that changed from 0/1 to False/True.
(The exception is test_unicode.py, which did a type(x) == type(y)
style comparison.  I could've fixed that with a single line using
issubtype(x, type(y)), but instead chose to be explicit about those
places where a bool is expected.

Still to do: perhaps more documentation; change standard library
modules to return False/True from predicates.
2002-04-03 22:41:51 +00:00
Fred Drake da8a6dd072 Added missing version annotation for dict(). 2002-03-06 02:29:30 +00:00
Tim Peters 9f4341b3b0 SF bug #501591: dir() doc is old
Bugfix candidate.

+ Updated dir() description to match actual 2.2 behavior.

+ Replaced the dir(sys) example with dir(struct), because the former
  was way out of date and is bound to change frequently, while the
  latter is stable.

+ Added a note cautioning that dir() is supplied primarily for
  convenience at an interactive prompt (hoping to discourage its
  use as the foundation of introspective code outside the core).
2002-02-23 04:40:15 +00:00
Fred Drake 732299ff63 Add documentation for the help() built-in; contributed by Ka-Ping Yee.
This is part of SF patch #494622.
2001-12-18 16:31:08 +00:00
Fred Drake 526c7a0101 Ensure that complex() only accepts a string argument as the first arg,
and only if there is no second arg.
This closes SF patch #479551.
2001-12-13 19:52:22 +00:00
Fred Drake 5172adca81 Minor clarification of the zip() description, based on a comment sent to
python-docs.
2001-12-03 18:35:05 +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 0b66310476 When referring to a formal parameter from the description, use the name given
with the signature, not an ad hoc abbreviated form.
2001-11-07 06:28:47 +00:00
Fred Drake 66ded524ba apply() documentation: Remove a detail about the implementation that does
not affect the API.  Clean up the text about call syntax apply() is
equivalent to.  Based on comments by Thomas Guettler.
2001-11-07 06:22:25 +00:00
Tim Peters a427a2b8d0 Rename "dictionary" (type and constructor) to "dict". 2001-10-29 22:25:45 +00:00
Fred Drake ef7d08a661 Some style changes and typo fixes. 2001-10-26 15:04:33 +00:00
Tim Peters 1fc240e851 Generalize dictionary() to accept a sequence of 2-sequences. At the
outer level, the iterator protocol is used for memory-efficiency (the
outer sequence may be very large if fully materialized); at the inner
level, PySequence_Fast() is used for time-efficiency (these should
always be sequences of length 2).

dictobject.c, new functions PyDict_{Merge,Update}FromSeq2.  These are
wholly analogous to PyDict_{Merge,Update}, but process a sequence-of-2-
sequences argument instead of a mapping object.  For now, I left these
functions file static, so no corresponding doc changes.  It's tempting
to change dict.update() to allow a sequence-of-2-seqs argument too.

Also changed the name of dictionary's keyword argument from "mapping"
to "x".  Got a better name?  "mapping_or_sequence_of_pairs" isn't
attractive, although more so than "mosop" <wink>.

abstract.h, abstract.tex:  Added new PySequence_Fast_GET_SIZE function,
much faster than going thru the all-purpose PySequence_Size.

libfuncs.tex:
- Document dictionary().
- Fiddle tuple() and list() to admit that their argument is optional.
- The long-winded repetitions of "a sequence, a container that supports
  iteration, or an iterator object" is getting to be a PITA.  Many
  months ago I suggested factoring this out into "iterable object",
  where the definition of that could include being explicit about
  generators too (as is, I'm not sure a reader outside of PythonLabs
  could guess that "an iterator object" includes a generator call).
- Please check my curly braces -- I'm going blind <0.9 wink>.

abstract.c, PySequence_Tuple():  When PyObject_GetIter() fails, leave
its error msg alone now (the msg it produces has improved since
PySequence_Tuple was generalized to accept iterable objects, and
PySequence_Tuple was also stomping on the msg in cases it shouldn't
have even before PyObject_GetIter grew a better msg).
2001-10-26 05:06:50 +00:00
Marc-André Lemburg b5507ecd3c Additional test and documentation for the unicode() changes.
This patch should also be applied to the 2.2b1 trunk.
2001-10-19 12:02:29 +00:00
Fred Drake e0063d20a7 Update the documentation for the isinstance() function to reflect recent
changes in the implementation.
Indented all descriptions consistently.
2001-10-09 19:31:08 +00:00
Tim Peters 3899d74c10 Make clear that tuple() accepts the same kind of arguments as list(). 2001-10-04 06:53:20 +00:00
Tim Peters af5910f025 The execfile() docs imply it acts on locals same as exec. But in truth
it acts more like assigning to keys in locals(), i.e. modifications to
function locals aren't reflected in the locals when execfile() returns.
2001-09-30 06:32:59 +00:00
Tim Peters 1c33daf143 Correct docs for long(float). 2001-09-30 06:18:26 +00:00
Guido van Rossum 0d68246f01 Fix two typos in the text about compile(), and add two caveats from
recent user feedback: you must end the input with \n and you must use
\n, not \r\n to represent line endings.
2001-09-29 14:28:52 +00:00
Tim Peters 2e29bfbe1a Document new file() constructor, with the body of open()'s text, plus a
"new in 2.2" blurb at the end.  Replace open()'s text by pointing back
to file().
2001-09-20 19:55:29 +00:00
Fred Drake 00bb329521 Document the built-in iter() function. 2001-09-06 19:04:29 +00:00
Tim Peters 32f453eaa4 New restriction on pow(x, y, z): If z is not None, x and y must be of
integer types, and y must be >= 0.  See discussion at
http://sf.net/tracker/index.php?func=detail&aid=457066&group_id=5470&atid=105470
2001-09-03 08:35:41 +00:00
Michael W. Hudson 53da317801 Docs for the PEP 264 changes. 2001-08-27 20:02:17 +00:00
Tim Peters 7321ec437b SF bug #444510: int() should guarantee truncation.
It's guaranteed now, assuming the platform modf() works correctly.
2001-07-26 20:02:17 +00:00
Guido van Rossum bf5a774bcb On int/long to the negative int/long power, let float handle it
instead of raising an error.  This was one of the two issues that the
VPython folks were particularly problematic for their students.  (The
other one was integer division...)  This implements (my) SF patch
#440487.
2001-07-12 11:27:16 +00:00
Fred Drake 91f2f26d75 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 19:28:48 +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
Fred Drake eacdec6b38 Update the filter() and list() descriptions to include information about
the support for containers and iteration.
2001-05-02 20:19:19 +00:00
Marc-André Lemburg 6f77667a64 Backed out the unistr() builtin. 2001-01-19 21:36:19 +00:00
Fred Drake bc0b260a77 Minor markup cleaning, and one required fix in the unistr() description. 2001-01-18 18:09:07 +00:00
Marc-André Lemburg ad7c98e264 This patch adds a new builtin unistr() which behaves like str()
except that it always returns Unicode objects.

A new C API PyObject_Unicode() is also provided.

This closes patch #101664.

Written by Marc-Andre Lemburg. Copyright assigned to Guido van Rossum.
2001-01-17 17:09:53 +00:00
Fred Drake 9c15fa7a0f Description of long(): A string parameter is no longer required to be
*decimal*.

This closes SF bug #127273.
2001-01-04 05:09:16 +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 1349437e4c When referring to namespaces, always say "namespaces" instead of
"name spaces".

Inconsistency noted by Keith Briggs <keith.briggs@bt.com>.
2000-09-12 16:23:48 +00:00
Fred Drake f96e0d203b Various clarifications and minor nits fixed. Affected descriptions of
input(), locals(), reload(), unicode(), and zip().
2000-09-09 03:33:42 +00:00
Fred Drake e581bb30c4 Small cleanups, and note when zip() entered the menagerie. 2000-08-17 22:30:30 +00:00
Fred Drake 8b168ba505 int() description: Fix markup to avoid image generation for math mode.
zip() description:  Fix broken markup, three small markup consistency nits,
	and one really minor usage nit.  Introduce use of \moreargs instead
	of hardcoding "..." with \optional.
2000-08-03 17:29:13 +00:00
Barry Warsaw faefa2a885 Both PEP 201 Lockstep Iteration and SF patch #101030 have been
accepted by the BDFL.

Added documentation for zip() builtin.
2000-08-03 15:46:17 +00:00
Fred Drake 30f76ffd00 Update version numbering from 1.6 to 2.0. 2000-06-30 16:06:19 +00:00
Fred Drake 8aa3bd9098 Make it clear that id() can return either a long integer or a plain integer. 2000-06-29 03:46:46 +00:00
Fred Drake 343301aaa4 unichr(),
unicode():  Added \versionadded{} annotations.
2000-04-06 15:06:03 +00:00
Fred Drake 665dd704a3 Note the exception raised when parameter to chr() is out of range. 2000-04-06 14:45:19 +00:00
Fred Drake 33d51841a3 Marc-Andre Lemburg <mal@lemburg.com>:
Documentation for unichr(), unicode(), update for ord().
2000-04-06 14:43:12 +00:00
Fred Drake 1e862e8a37 Update the description of int() to include the radix parameter;
omission noted on c.l.py by Aahz Maruch.

Swapped the order of the descriptions of int() and intern() so that
int() comes first (the functions are in alphabetic order).
2000-02-17 17:45:52 +00:00
Fred Drake d3fbdfd007 Add index entries for open():
buffer size, I/O
	I/O control, buffering
	line-buffered I/O
	unbuffered I/O
1999-08-05 13:43:08 +00:00
Fred Drake de5d5ce7bc Update getattr() description to document the optional third
parameter.  Thanks to Barry Warsaw for pointing out the oversight.
1999-07-22 19:21:45 +00:00
Fred Drake 697c779d98 Adjust indexing for __import__(); based on comments by Stefan Franke
<sfranke@cdc-group.com>.
1999-06-10 22:09:20 +00:00
Fred Drake 1ea7c75687 Reflect recent patch for float % and divmod() by Tim Peters. Content
updates by Tim Peters, markup by FLD.
1999-05-06 14:46:35 +00:00
Fred Drake 9aa8543c84 open() description: Made it more clear that 'b' should always be
added to the mode value for binary files to improve
	portability.

Fixed latex2html weirdness with a couple of footnotes.
1999-04-05 21:22:41 +00:00
Guido van Rossum cb1f2420ea Document complex() with string arg. 1999-03-25 21:23:26 +00:00
Guido van Rossum 8be229650d Document new builtin buffer(). Greg Stein. 1999-03-19 19:10:14 +00:00
Fred Drake 70a66c9d6d Add notes to __builtin__.float() and string.atof() that the NaN and Inf
results are possible but non-portable.
1999-02-18 16:08:36 +00:00
Fred Drake 951eea4733 atof() description: Add information about accepting 'NaN' to produce
the NaN value.
1999-02-18 03:49:20 +00:00
Guido van Rossum 87e611e441 Replace the docs for reduce with an adaptation of its docstring, which
was actually clearer!
1999-01-06 23:10:51 +00:00
Fred Drake d83675f344 "singed" --> "signed" (3 places)
Noticed by Andrew MacIntyre <andymac@bullseye.apana.org.au>.
1998-12-07 17:13:18 +00:00
Guido van Rossum 8c2da61811 Add explicit example on how to import a submodule of a package using
__import__ and getattr().
1998-12-04 15:32:17 +00:00
Guido van Rossum 5eabf3823b Clarify that min and max also take multiple arguments. 1998-11-25 18:53:05 +00:00
Fred Drake 2510d22048 Clarify the default buffering for open(). (Comment from Andrew Dalke
<dalke@bioreason.com>).
1998-11-02 18:57:34 +00:00
Barry Warsaw b2031f72d3 Document that apply() can now take any sequence in argument 2. 1998-10-01 15:35:43 +00:00
Fred Drake 607f802886 round(): Mark the second (optional) parameter as optional, since it's
described that way.

setattr():  Clarify that the attribute doesn't need to exist to be set.
1998-08-24 20:30:07 +00:00
Fred Drake 295da24eaf New section header style.
Fix up a few synopses.
1998-08-10 19:42:37 +00:00
Guido van Rossum 5fdd119aba Clarify the + and b mode characters for open() a bit. 1998-07-29 21:05:35 +00:00
Guido van Rossum a7874d1505 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...
1998-06-22 14:07:36 +00:00
Fred Drake 1b0ff2c32f eval() example: Removed final interpreter prompt; other examples don't have
the empty prompt.
1998-06-19 21:19:50 +00:00
Guido van Rossum 7b7f6688d2 Added a stronger warning about changing the dictionary returned by
locals().
1998-06-18 16:45:34 +00:00
Guido van Rossum 777dcc6b21 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.
1998-06-17 15:16:40 +00:00
Fred Drake 6b303b4bdd Signature for dir() omitted the optional argument. 1998-04-16 22:10:27 +00:00
Fred Drake 6251c169c6 Small nits.
One more index entry.

Be more specific about an exception raised by range().
1998-04-03 07:15:54 +00:00
Fred Drake 0a73d4db51 Removed reference to ni module. 1998-04-02 18:46:44 +00:00
Fred Drake cce1090d49 Change "\," to just "," in function signatures. This is easier to maintain,
works better with LaTeX2HTML, and allows some simplification of the python.sty
macros.
1998-03-17 06:33:25 +00:00
Fred Drake 53525379da Logical markup. 1998-03-03 21:56:15 +00:00
Fred Drake 315b5d8a7f In description of __import__, second paragraph, break up the markup for long
\code{} at each embedded space, so that the words will wrap.  This keeps it
from running off the side of the page, and is only slightly weird.
1998-02-13 21:26:35 +00:00
Fred Drake 1947991c2f Remove all \bcode / \ecode cruft; this is no longer needed. See previous
checkin of myformat.sty.

Change "\renewcommand{\indexsubitem}{(...)}" to "\setindexsubitem{(...)}"
everywhere.

Some other minor nits that I happened to come across.
1998-02-13 06:58:54 +00:00
Fred Drake af8a015c93 Consistency: "{\bf ...}" ==> "\strong{...}"
"{\em ...}" ==> "\emph{...}"

	      Not at all sure what to do with "{\rm ...}".
	      Leaving it for now.
1998-01-14 14:51:31 +00:00
Fred Drake fd49a964bc Follow current recommended practice in an example: Use isinstance() to
perform a type test instead of type(x) == types.FoobarType.  In example
for type().
1998-01-11 21:15:23 +00:00
Guido van Rossum eb0f066fb8 Correct small nits reported by Rob Hooft. 1997-12-30 20:38:16 +00:00
Fred Drake 90f2e5e202 Added a named target for referencing. 1997-12-16 04:06:33 +00:00
Fred Drake e14388c4b8 Fixed index references to modules. 1997-12-15 22:28:38 +00:00
Guido van Rossum 3593e5c4c3 Document new behavior of isinstance() when using a type object. 1997-12-02 19:15:01 +00:00
Guido van Rossum 7974b0f2d8 Documented __import__, callable, isinstance, issubclass,
and slice.
1997-10-05 18:53:00 +00:00
Guido van Rossum e47da0ae04 AMK's megapatch:
* \bcode, \ecode added everywhere
	* \label{module-foo} added everywhere
	* A few \seealso sections added.
	* Indentation fixed inside verbatim in lib*tex files
1997-07-17 16:34:52 +00:00
Guido van Rossum 921f32ce4c Mention abs(complex) -> magnitude (AMK).
Documented list().
Mention [raw_]input()'s interface to GNU readline.
1997-06-02 17:21:20 +00:00
Guido van Rossum 1cd26f2fc0 Add complex().
Update int(), long(), float() to support string conversions.
1997-04-02 06:04:02 +00:00
Guido van Rossum 3978d75cca Added intern() 1997-03-03 16:03:27 +00:00
Guido van Rossum 5cd752028c Describe new ("unsigned") behavior of hex() and oct(). 1997-01-14 18:44:23 +00:00
Fred Drake 4b3f0312c9 (lib<all sorts of stuff>.tex):
Merged in many typo corrections and fixes to support GNU info
	processing; submitted by Tamito Kajiyama.
1996-12-13 22:04:31 +00:00
Guido van Rossum 1dde7b737c Typos detected by Sjoerd 1996-10-11 15:57:17 +00:00
Guido van Rossum 59b328e11e Added warning about behavior of open mode 'a' (or 'a+'). 1996-05-02 15:16:59 +00:00
Guido van Rossum 0568d5e92c apply() third arg 1995-10-08 01:06:46 +00:00