summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1994-08-29 12:53:40 (GMT)
committerGuido van Rossum <guido@python.org>1994-08-29 12:53:40 (GMT)
commit14144fcdfde3efdac2d2c609b985ade5edc4eda2 (patch)
tree871f4f72e5b9af72f71a0f678fd6f7930cda2020 /Python
parentcae027b2988de4ad7165288907f91ba2f280bd98 (diff)
downloadcpython-14144fcdfde3efdac2d2c609b985ade5edc4eda2.zip
cpython-14144fcdfde3efdac2d2c609b985ade5edc4eda2.tar.gz
cpython-14144fcdfde3efdac2d2c609b985ade5edc4eda2.tar.bz2
Added delattr()
Diffstat (limited to 'Python')
-rw-r--r--Python/bltinmodule.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index fd98365..67b7e26 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -638,6 +638,21 @@ builtin_setattr(self, args)
}
static object *
+builtin_delattr(self, args)
+ object *self;
+ object *args;
+{
+ object *v;
+ object *name;
+ if (!getargs(args, "(OS)", &v, &name))
+ return NULL;
+ if (setattro(v, name, (object *)NULL) != 0)
+ return NULL;
+ INCREF(None);
+ return None;
+}
+
+static object *
builtin_hash(self, args)
object *self;
object *args;
@@ -1264,6 +1279,7 @@ static struct methodlist builtin_methods[] = {
{"cmp", builtin_cmp},
{"coerce", builtin_coerce},
{"compile", builtin_compile},
+ {"delattr", builtin_delattr},
{"dir", builtin_dir},
{"divmod", builtin_divmod},
{"eval", builtin_eval},