Kaydet (Commit) fb8f1cad authored tarafından Guido van Rossum's avatar Guido van Rossum

Add clear() method to dictionary objects.

üst 3ee6b195
......@@ -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},
......
......@@ -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},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment