summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2002-08-19 03:19:09 (GMT)
committerRaymond Hettinger <python@rcn.com>2002-08-19 03:19:09 (GMT)
commit5959c559df777eb61b10d986e45ed4bbf269b36d (patch)
treed9b6621c5b43c18788a73f74cb98238cd333fec0 /Modules
parent7dca21e59fdf088cb9cc7d04f03b6fd2a7c9d509 (diff)
downloadcpython-5959c559df777eb61b10d986e45ed4bbf269b36d.zip
cpython-5959c559df777eb61b10d986e45ed4bbf269b36d.tar.gz
cpython-5959c559df777eb61b10d986e45ed4bbf269b36d.tar.bz2
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.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/operator.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/Modules/operator.c b/Modules/operator.c
index 229fbac..55c26df 100644
--- a/Modules/operator.c
+++ b/Modules/operator.c
@@ -102,6 +102,15 @@ spamrc(op_gt , Py_GT)
spamrc(op_ge , Py_GE)
static PyObject*
+op_pow(PyObject *s, PyObject *a)
+{
+ PyObject *a1, *a2;
+ if (PyArg_ParseTuple(a,"OO:pow",&a1,&a2))
+ return PyNumber_Power(a1, a2, Py_None);
+ return NULL;
+}
+
+static PyObject*
op_getslice(PyObject *s, PyObject *a)
{
PyObject *a1;
@@ -199,6 +208,7 @@ spam2(setitem,__setitem__,
"setitem(a, b, c) -- Same as a[b] = c.")
spam2(delitem,__delitem__,
"delitem(a, b) -- Same as del a[b].")
+spam2(pow,__pow__, "pow(a, b) -- Same as a**b.")
spam2(getslice,__getslice__,
"getslice(a, b, c) -- Same as a[b:c].")
spam2(setslice,__setslice__,