Add clear() method to dictionary objects.

This commit is contained in:
Guido van Rossum 1997-03-21 21:55:12 +00:00
parent 3ee6b195bb
commit fb8f1cadb2
2 changed files with 26 additions and 0 deletions

View file

@ -880,7 +880,20 @@ mapping_has_key(mp, args)
return newintobject(ok);
}
static object *
mapping_clear(mp, args)
register mappingobject *mp;
object *args;
{
if (!getnoarg(args))
return NULL;
mappingclear((object *)mp);
INCREF(None);
return None;
}
static struct methodlist mapp_methods[] = {
{"clear", (method)mapping_clear},
{"has_key", (method)mapping_has_key},
{"items", (method)mapping_items},
{"keys", (method)mapping_keys},