Commit Graph

93 Commits

Author SHA1 Message Date
Michael W. Hudson f0d777c56b A few days ago, Guido said (in the thread "[Python-Dev] Python
version of PySlice_GetIndicesEx"):

> OK.  Michael, if you want to check in indices(), go ahead.

Then I did what was needed, but didn't check it in.  Here it is.
2002-07-19 15:47:06 +00:00
Raymond Hettinger 10cbe8dcbc SF 563530 added missing methods for emulating numeric types 2002-06-20 06:12:37 +00:00
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