Commit Graph

141 Commits

Author SHA1 Message Date
Michael W. Hudson 5efaf7eac8 This is my nearly two year old patch
[ 400998 ] experimental support for extended slicing on lists

somewhat spruced up and better tested than it was when I wrote it.

Includes docs & tests.  The whatsnew section needs expanding, and arrays
should support extended slices -- later.
2002-06-11 10:55:12 +00:00
Fred Drake 293dd4b77b Fix up Guido's markup. 2002-06-04 16:25:57 +00:00
Guido van Rossum 92cf95f45b Addressed SF bug 421973 (finally).
Rewrote the subsection on coercion rules (and made it a proper
subsection, with a label).  The new section is much less precise,
because precise rules would be too hard to give (== I don't know what
they are any more :-).  OTOH, the new section gives much more
up-to-date information.

Also noted that __coerce__ may return NotImplemented, with the same
meaning as None.

I beg Fred forgiveness: my use of \code{} is probably naive.  Please
fix this and other markup nits.  An index entry would be nice.

This could be a 2.2 bugfix candidate, if we bother about old docs
(Fred?)
2002-06-03 19:06:41 +00:00
Raymond Hettinger 94153096f5 Closes SF patch: 552468.
Type class unification invalidated the statement:  x.__getitem__[i] is not equivalent to x[i].
2002-05-12 03:09:25 +00:00
Fred Drake c0a02c084b Remove repeated index entry; adds nothing different.
Closes SF bug #518985.
2002-04-16 02:03:05 +00:00
Martin v. Löwis 2a519f8fe6 Document __unicode__. Fixes #541245. 2002-04-11 12:39:35 +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
Jeremy Hylton 8392f36579 Update documentation of code objects.
Split the description of co_flags into two paragraphs.  The first
describes the flags that are used for non-future purposes, where
CO_GENERATOR was added.  The second describes __future__'s use of
co_flags and mentions the only one currently meaningful,
CO_FUTURE_DIVISION.
2002-04-01 18:53:36 +00:00
Jeremy Hylton 26c49b66bb Small fixes for description of function attributes.
func_closure is a readonly attribute.
Add \ttindex{} for func_closure.
Remove discussion of func_closure specific to 2.1.
2002-04-01 17:58:39 +00:00
Fred Drake 591dd8f620 Update information about __del__() & reference cycles for CPython.
This partially fixes SF bug #492619.

Fix a typo & use the new notice environment instead of (ab)using the \note
and \warning macros.
2001-12-14 22:52:41 +00:00
Fred Drake e31e9cebc0 Document generators and the yield statement, avoiding implementation details. 2001-12-11 21:10:08 +00:00
Fred Drake f9d580346b Add change notes where im_class is discussed, since the exact meaning changes
with Python 2.2.
2001-12-07 23:13:53 +00:00
Guido van Rossum b62f0e1a7b Correct the description of im_class. (Fred, this is changed in 2.2.
Should this be labeled as changed?  How?)
2001-12-07 22:03:18 +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 0aa811c527 Use the \note and \warning macros where appropriate. 2001-10-20 04:24:09 +00:00
Fred Drake 73921b0eec Refer to the objects which define __len__(), __*item__(), and __iter__()
as container objects rather than as mapping objects (in the index entries).
Change the section heading and intro sentence to be a little more general,
since that's how things have actually evolved.
2001-10-01 16:32:13 +00:00
Fred Drake 18d8d5a708 Fix minor usage and consistency nits. 2001-09-18 17:58:20 +00:00
Fred Drake ed5a7ca5ee Work around a LaTeX2HTML bug that caused the "m" in "mutable" to be dropped
in one place.
2001-09-10 15:16:08 +00:00
Fred Drake 3e2aca48bd Add information about __floordiv__() and __truediv__() methods for
implementing numeric objects in Python.
2001-08-14 20:28:08 +00:00
Fred Drake 8dd6ffd0ec User-defined methods *can* contain things other than user-defined functions
as the callable, so use more flexible language.
2001-08-02 21:34:53 +00:00
Fred Drake 044bb4d22a Explain that __init__() methods do not get to return values. 2001-08-02 15:53:05 +00:00
Fred Drake 6e5e1d924c Minor change to match the style guide. 2001-07-14 02:12:27 +00:00
Fred Drake 2829f1cf99 Fix a very minor (but annoying when looking for things!) markup nit. 2001-06-23 05:27:20 +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 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
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
Fred Drake fb8ffe6b5e Work around the conversion of ">>" and "<<" to guillemets. Reported by Ping.
Wrap some long lines and fix some markup nits.
2001-04-13 15:54:41 +00:00
Jeremy Hylton aa90adcfb9 Add nested scopes spec to appendix.
Add new opcodes LOAD_CLOSURE, LOAD_DEREF, STORE_DEREF, MAKE_CLOSURE to
docs for dis module.

Add docs for new function and code members in Sec. 3 of ref manual.
They're present regardless of whether nested scopes are used.

Remove description of default argument hack from Sec. 7 of the ref
manual and refer the reader to the appendix.
2001-03-23 17:23:50 +00:00
Barry Warsaw 7a5e80e801 Updates to describe function attributes. 2001-02-27 03:36:30 +00:00
Fred Drake 230d17d0d1 Sequence indexes are non-negative, not natural (0 is not a natural number).
Reported by Daniel May <mayds@ecn.purdue.edu>.

De-tabified everywhere.
2001-02-22 21:28:04 +00:00
Fred Drake c8e8281fb6 Updated note about collection of cyclic garbage, based on comments from
Chris Ryland.
2001-01-22 17:46:18 +00:00
Guido van Rossum ab782dd6cc Document rich comparisons. 2001-01-18 15:17:06 +00:00
Fred Drake 445f832060 __rcmp__() description: Changed to indicate that this is no longer
supported as of Python 2.1.  We still need to
                         have an entry for this since it is reasonable
                         for users to want to understand existing code.

This closes SF bug #122715.
2001-01-04 15:11:48 +00:00
Neil Schemenauer 48c2eb9165 Document the NotImplemented object. 2001-01-04 01:25:50 +00:00
Andrew M. Kuchling 68abe832b9 Fix typo 2000-12-19 14:09:21 +00:00
Guido van Rossum 035f7e88c8 Clarify __repr__ and __str__. 2000-12-19 04:18:13 +00:00
Thomas Wouters dc90cc2b15 Additional docs for __iadd__ and family, closing SF bug #117178 and SF patch
#102169.
2000-12-11 23:11:51 +00:00
Fred Drake 0c47559352 Added a note that objects which emulate built-in types should only
implement as many of the relevant methods as make sense for the particular
information being modelled.
2000-12-07 04:49:34 +00:00
Fred Drake f89259786a Denis S. Otkidach <ods@users.sourceforge.net>:
Show how code can be written to handle __getslice__ & friends in a way that
is compatible with pre-2.0 versions of Python while still working with the
"new" way of handling slicing.

Additional explanation added by Fred Drake.

This closes SourceForge patch #101388.
2000-09-21 22:27:16 +00:00
Fred Drake 31575ce817 Note that __getitem__() may receive a slice object as the index;
reported by Detlef Lannert <lannert@uni-duesseldorf.de>.
2000-09-21 05:28:26 +00:00
Fred Drake 8d27f898b2 Moshe Zadka <mzadka@geocities.com>:
Document the __contains__() method.
(Patch slightly modified by FLD.)

This closes SourceForge patch #101387.
2000-09-19 18:21:25 +00:00
Thomas Wouters 12bba852a9 Rough and incomplete documentation on augmented assignment, which follows
shortly. Markup also needs checking.
2000-08-24 20:06:04 +00:00
Fred Drake a00738259f Adjust the way __getslice__() is marked as deprecated; this will also
stand out more.
2000-08-18 02:42:14 +00:00
Thomas Wouters 1d75a79c00 Apply SF patch #101029: call __getitem__ with a proper slice object if there
is no __getslice__ available. Also does the same for C extension types.
Includes rudimentary documentation (it could use a cross reference to the
section on slice objects, I couldn't figure out how to do that) and a test
suite for all Python __hooks__ I could think of, including the new
behaviour.
2000-08-17 22:37:32 +00:00
Thomas Wouters f9b526dbfd More of Rob W. W. Hooft's spelling fixes. The only ones left now are the
distutils patches, which I'll leave to the distutils maintainers.

Tip: review the patch like this:

grep "^[\!+-] " <patchfile>

To get a quick and easy way to review the actual changes. Most of the
changes are single-line ones, anyway.
2000-07-16 19:05:38 +00:00
Fred Drake 91826ed2a9 Improve the descriptions of expected exceptions for __getitem__(),
__setitem__(), and __delitem__().  Based on related comments from
Barry Warsaw.
2000-07-13 04:57:58 +00:00
Fred Drake 35c09f2e51 Revise the description of when functions retrieved from class instances
are and are not turned into bound methods; some confusion was noted by
Andrew Dalke.

In particular, it has to be noted that functions located on the class
instance are not turned into any sort of method, only those which are
found via the underlying class.
2000-06-28 20:15:47 +00:00
Fred Drake e57a11441e Fix markup error that hid a tilde character; reported long ago by
Carl Feynman <carlf@abinitio.com>.
2000-06-15 20:07:25 +00:00
Fred Drake 8b3ce9e099 But don't do the funny \UNICODE macro; we're trying to get away from
those markups!  <with-mixed-feelings>
2000-04-06 14:00:14 +00:00
Fred Drake f0aff8e759 Patch from Marc-Andre Lemburg <mal@lemburg.com>:
Added Unicode type to the language reference.
2000-04-06 13:57:21 +00:00
Fred Drake e15956b465 Merged changes from the 1.5.2p2 release. 2000-04-03 04:51:13 +00:00
Fred Drake e15eb35fd0 Use \citetitle as appropriate. 1999-11-10 16:13:25 +00:00
Fred Drake b894370f6a Fixed some index entries.
In the __coerce__ description, None should be returned if the
conversion is *impossible*, not *possible*.  Reported by Robert Kern
<kernr@ncifcrf.gov>.
1999-05-10 13:43:22 +00:00
Fred Drake 8cdee961bf Dictionaries are created using the "{...}" notation, not the "..."
notation.  Problem reported by Magnus L. Hetland <mlh@idt.ntnu.no>.
1999-02-23 18:50:38 +00:00
Guido van Rossum 264bd59221 1. Clarify that immutability isn't entirely the same as unchangeable
value (because of immutable containers containing mutable objects).

2. Document that func_code, func_defaults and func_doc / __doc__ are
now writable.
1999-02-23 16:40:55 +00:00
Fred Drake 15988fdbbb Documented __complex__(), made sure all the discipline names hit the
index.
1999-02-12 18:14:57 +00:00
Fred Drake ae3e574170 "numberic" --> "numeric", two places 1999-01-28 23:21:49 +00:00
Fred Drake 4856d01797 Removed a lot of unnecessary comment markers which cause unexplained
numbers to appear in the HTML version of the manual.
1999-01-12 04:15:20 +00:00
Fred Drake 78eebfdbf4 Remove two remaining {\tt ...} constructs. 1998-11-25 19:09:24 +00:00
Fred Drake 1e42d8aaab Massive change to just about every construct that impacts the index.
Blame it on Just.  ;-)
1998-11-25 17:58:50 +00:00
Fred Drake 3041b0715b Remove an unnecessary "%" character that seems to cause a minor glitch
with the latest latex2html.
1998-10-21 00:25:32 +00:00
Fred Drake 82385872e9 Fix some confusion in the __repr__() and __str__() descriptions.
Reported by Lorenzo M. Catucci <lorenzo@argon.roma2.infn.it>.
1998-10-01 20:40:43 +00:00
Fred Drake d82575d5bf Markup changes in the section on disciplines to match method descriptions
a little better, and produce better HTML.

Add some index entries.
1998-08-28 20:03:12 +00:00
Barry Warsaw 92a6ed9940 Minor refilling of a paragraph... 1998-08-07 16:33:51 +00:00
Fred Drake 70da192f63 im_function --> im_func 1998-08-07 16:28:13 +00:00
Fred Drake 61c7728cc9 Make sure all chapters, sections, and subsections have a \label to give them
semantic file names in the HTML.  No more node#.html files!
1998-07-28 19:34:22 +00:00
Guido van Rossum 7c0240f112 e.g. -> e.g., 1998-07-24 15:36:43 +00:00
Guido van Rossum dfb658c386 'name space' -> 'namespace' 1998-07-23 17:54:36 +00:00
Guido van Rossum 83b2f8ad3d Lots of changes copied from the FrameMaker version. Also documented
some previously undocumented features.
1998-07-23 17:12:46 +00:00
Fred Drake 5c07d9b028 Updated markup style (got rid of \verb@...@, mostly). 1998-05-14 19:37:06 +00:00
Fred Drake f666917ab7 The Python Reference Manual. 1998-05-06 19:52:49 +00:00
Guido van Rossum 1f17543ee7 Removed LaTeX version of reference manual. Added ref/ref.ps. 1996-10-22 20:00:02 +00:00
Guido van Rossum 1fd5b21425 Mention warning for exception in __del__. 1996-08-20 18:03:48 +00:00
Guido van Rossum 45687bb976 Add warning about exceptions in __del__ being ignored. 1996-08-09 20:59:25 +00:00
Guido van Rossum 1dead9bd0a Added __doc__ to predefined module attributes. 1996-06-26 19:29:21 +00:00
Guido van Rossum 8fd02194c5 typos 1995-07-07 23:05:13 +00:00
Guido van Rossum aaec403a75 added index entries for __*__ identifiers 1995-03-21 14:41:57 +00:00
Guido van Rossum a54754719d made palatable for latex2html:
removed $math$, added braces to \item[\tt...]
1995-03-16 14:44:07 +00:00
Guido van Rossum 47b4c0fb35 replace ASCII by macro call 1995-03-15 11:25:32 +00:00
Guido van Rossum 3d54de2ab9 clarified code objects 1995-03-07 10:09:55 +00:00
Guido van Rossum 8675115e5f a few typographical changes (e.g. -- => ---) and lots of new stuff in the WWW chapter 1995-02-28 17:14:32 +00:00
Guido van Rossum 31cce97374 copyright.tex: Add 1995 to copyright message.
lib.tex: add libimp; remove bogus warning about lineii.
libmath.tex: document hypot().
libmd5.tex: rename md5.md5() to md5.new().
libposix.tex: document chown().
libposixfile.tex: openfile() instead of fileopen().
libsocket.tex: document gethostbyaddr().
libtypes.tex: add footnote explaining why readline() keeps the newline.
ref3.tex: correct typos, add back*quotes to index.
ref4.tex: don't use \verb inside footnote.
ref5.tex: explain repr() and str() and add them + back*quotes to index.
ref6.tex: correct typo, don't use \verb in footnote.
ref7.tex: don't use \verb in footnote.
1995-01-04 19:17:34 +00:00
Guido van Rossum 29c1b97d28 __call__, __getattr__ c.s. 1994-10-09 22:56:16 +00:00
Guido van Rossum 6938f06047 Merge alpha100 branch back to main trunk 1994-08-01 12:22:53 +00:00
Guido van Rossum 7a2dba2a00 * ext.tex: documentation for extending, reference counts, and embedding
(formerly ../misc/{EXTENDING,REFCNT,EMBEDDING}).  Also affects Makefile.
* text2latex.py: script to do part of the conversion from an plain ASCI
  text file (in my particular style) to LaTeX.
  (Chapter/section/subsection headers, and verbatim sections.)
* partparse.py, texipre.dat, fix.el, Makefile: Minor cleanup of latex ->
  info conversion process (at least it works again, and with less
  debugging output).  Removed fix.sh.
* lib1.tex (section{Built-in Functions}): adapt description of str() and
  repr() to new situation.
* lib3.tex (Module os): added exec*() variants.
* lib3.tex (Module posix): added execve().
* lib2.tex (Module array): documented reality; remove typecode and
itemsize, add byteswap, rename read/write to fromfile/tofile, and
re-alphabetized.
* lib1.tex (Built-in Functions): renamed bagof() to filter().
1993-11-05 14:45:11 +00:00
Guido van Rossum 7f8765d327 * ref3.tex: added cross-ref to try statement for exc handler.
* ref7.tex: added description of sys.exc_{type,value,traceback}.
* lib5.tex: rect.intersect is different now!
1993-10-11 12:54:58 +00:00
Guido van Rossum 23301a9467 * lib1.tex: documented dict.items() and dict.values()
* ref3.tex: documented new __init__ and __del__ special methods of
  class instances.
1993-05-24 14:19:37 +00:00
Guido van Rossum b2c6556fb0 Lots of small changes collected over months... 1993-05-12 08:53:36 +00:00
Guido van Rossum 66122d2dae __oct__ and __hex__ 1992-09-20 21:43:47 +00:00
Guido van Rossum 46f3e00407 Initial revision 1992-08-14 09:11:01 +00:00