Commit Graph

43 Commits

Author SHA1 Message Date
Georg Brandl ebcfd11c16 #1506171: added operator.methodcaller(). 2008-02-23 23:04:35 +00:00
Georg Brandl e2065c65d3 #1826: allow dotted attribute paths in operator.attrgetter. 2008-02-23 23:02:23 +00:00
Martin v. Löwis 6819210b9e PEP 3123: Provide forward compatibility with Python 3.0, while keeping
backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and
PyVarObject_HEAD_INIT.
2007-07-21 06:55:02 +00:00
Georg Brandl 40c626159d Patch #1654417: make operator.{get,set,del}slice use the full range
of Py_ssize_t.
2007-03-06 18:59:11 +00:00
Neal Norwitz 8a87f5d37e Patch #1538606, Patch to fix __index__() clipping.
I modified this patch some by fixing style, some error checking, and adding
XXX comments.  This patch requires review and some changes are to be expected.
I'm checking in now to get the greatest possible review and establish a
baseline for moving forward.  I don't want this to hold up release if possible.
2006-08-12 17:03:09 +00:00
Martin v. Löwis 26fd9607c7 Fix more ssize_t problems. 2006-04-22 11:15:41 +00:00
Thomas Wouters c6e55068ca Use Py_VISIT in all tp_traverse methods, instead of traversing manually or
using a custom, nearly-identical macro. This probably changes how some of
these functions are compiled, which may result in fractionally slower (or
faster) execution. Considering the nature of traversal, visiting much of the
address space in unpredictable patterns, I'd argue the code readability and
maintainability is well worth it ;P
2006-04-15 21:47:09 +00:00
Guido van Rossum 38fff8c4e4 Checking in the code for PEP 357.
This was mostly written by Travis Oliphant.
I've inspected it all; Neal Norwitz and MvL have also looked at it
(in an earlier incarnation).
2006-03-07 18:50:55 +00:00
Martin v. Löwis ad0a4629be Use Py_ssize_t for counts and sizes. 2006-02-16 14:30:23 +00:00
Neal Norwitz 1ac754fa10 Check return result from Py_InitModule*(). This API can fail.
Probably should be backported.
2006-01-19 06:09:39 +00:00
Armin Rigo f5bd3b442d adding in-place operators to the operator module. 2005-12-29 16:50:42 +00:00
Armin Rigo c4308d5be6 two missing PyDoc_STR(). 2005-12-29 14:39:28 +00:00
Georg Brandl 02c42871cf Disallow keyword arguments for type constructors that don't use them.
(fixes bug #1119418)
2005-08-26 06:42:30 +00:00
Raymond Hettinger 984f9bb714 operator.itemgetter() and operator.attrgetter() now support extraction
of multiple fields.  This provides direct support for sorting by
multiple keys.
2005-03-09 16:38:48 +00:00
Raymond Hettinger bd3a240e6d Fix typos. 2003-12-04 22:17:49 +00:00
Raymond Hettinger 166958b5df As discussed on python-dev, added two extractor functions to the
operator module.
2003-12-01 13:18:39 +00:00
Raymond Hettinger 9543b34006 SF patch #670423: Add missing identity tests to operator.c 2003-01-18 23:22:20 +00:00
Raymond Hettinger 36cd2bf459 SF patch 660559: Use METH_O and METH_NOARGS where possible
Simplify code and speed access by using PyArg_UnpackTuple, METH_O and
METH_NOARGS in three modules that can benefit from it.
2003-01-03 08:24:58 +00:00
Raymond Hettinger ea3fdf44a2 SF patch #659536: Use PyArg_UnpackTuple where possible.
Obtain cleaner coding and a system wide
performance boost by using the fast, pre-parsed
PyArg_Unpack function instead of PyArg_ParseTuple
function which is driven by a format string.
2002-12-29 16:33:45 +00:00
Raymond Hettinger 5959c559df Added __pow__(a,b) to the operator module. Completes the pattern of
all operators having a counterpart in the operator module.

Closes SF bug #577513.
2002-08-19 03:19:09 +00:00
Neal Norwitz 200788ce45 Allow more docstrings to be removed during compilation in some modules 2002-08-13 22:20:41 +00:00
Mark Hammond fe51c6d66e Excise DL_EXPORT/DL_IMPORT from Modules/*. Required adding a prototype
for Py_Main().

Thanks to Kalle Svensson and Skip Montanaro for the patches.
2002-08-02 02:27:13 +00:00
Martin v. Löwis 14f8b4cfcb Patch #568124: Add doc string macros. 2002-06-13 20:33:02 +00:00
Guido van Rossum 2e1c09c1fd Removed old Digital Creations copyright/license notices (with
permission from Paul Everitt).  Also removed a few other references to
Digital Creations and changed the remaining ones to Zope Corporation.
2002-04-04 17:52:50 +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 428e75fc3e Add wrappers around the rich-comparison operations.
This closes SF patch #428320.

Add wrappers to expose "floor" and "true" division.
This closes SF feature request #449093.
2001-08-09 20:14:34 +00:00
Fred Drake ea4d3f0804 Add invert() and __invert__() as aliases for inv()/__inv__().
Add contains() as alias for __contains__().
Make PyArg_ParseTuple() formats include the function name.

Based on patch by Denis S. Otkidach <ods@users.sourceforge.net>,
this closes SourceForge patch #101390.
2000-09-17 16:09:27 +00:00
Thomas Wouters f3f33dcf03 Bunch of minor ANSIfications: 'void initfunc()' -> 'void initfunc(void)',
and a couple of functions that were missed in the previous batches. Not
terribly tested, but very carefully scrutinized, three times.

All these were found by the little findkrc.py that I posted to python-dev,
which means there might be more lurking. Cases such as this:

long
func(a, b)
	long a;
	long b; /* flagword */
{

and other cases where the last ; in the argument list isn't followed by a
newline and an opening curly bracket. Regexps to catch all are welcome, of
course ;)
2000-07-21 06:00:07 +00:00
Fred Drake 0c89d4ec9a Pretensions of the 20th century... remove old-style preprocessor
hackery (/**/), leaving only new-style preprocessor hackery (##).
2000-07-08 04:53:48 +00:00
Fred Drake 5639ba4896 ANSI-fy the sources. 2000-07-08 04:12:08 +00:00
Guido van Rossum 3886bb6997 Add DL_EXPORT() to all modules that could possibly be used
on BeOS or Windows.
1998-12-04 18:50:17 +00:00
Guido van Rossum 832f6d2890 Add an alias (and preferred name) "contains" for "sequenceIncludes".
Rationalized the doc strings.

Also simplify the module initialization -- we don't need a __version__
which is set to "$Rev" :-) and we don't need a fatal error when the
initialization fails.
1998-05-22 18:12:59 +00:00
Guido van Rossum b1ed9c5295 PySequence_In() -> PySequence_Contains(). 1998-05-22 00:54:16 +00:00
Guido van Rossum 99c185e787 Add not_ and __not__. 1998-04-09 17:54:26 +00:00
Guido van Rossum 9efe8ef7a1 #Plug small memory leaks in constructors. 1997-09-03 18:19:40 +00:00
Guido van Rossum 24a49941b3 Some long variables should have been int to match the 'i' format specifier. 1997-08-28 18:11:05 +00:00
Barry Warsaw 19f61ae196 Tabification changes only; the module was already newly named. 1996-12-18 19:50:00 +00:00
Guido van Rossum 36a484fb52 Correct typo -- repeat implements *, not +. 1996-12-05 19:01:16 +00:00
Guido van Rossum 497aedd2ff Get rid of unused local variable. 1996-08-21 23:46:01 +00:00
Guido van Rossum c9fb47ef08 Added delslice and delitem.
Renamed and, or to and_, or_.
Renamed all internal identifiers so as not to start with '__' (which is
a compiler privilege); remove AIX hack.
1996-08-21 17:40:51 +00:00
Guido van Rossum 1720230399 Made it palatable for K&R preprocessors. The spam macros don't have
to work as hard (but "stringizing" is still used, so we test the newly
introduced HAVE_OLD_CPP config define).
1996-08-19 22:01:39 +00:00
Guido van Rossum ec185bde77 Added hack to get it to compile on AIX. 1996-08-08 19:12:05 +00:00
Guido van Rossum 037b940cd7 Operators like __add__ 1996-07-30 16:55:54 +00:00