Re: getargs and object*'s

Guido.van.Rossum@cwi.nl
Mon, 21 Mar 1994 09:23:42 +0100

> If I ask getargs to parse out an object* for me, i.e.
>
> if (getargs(args, "O", &an_object)) {...
>
> and args contains an intobject, will I simply get a pointer to the
> intobject? I've been using this mechanism to parse for an
> instanceobject and I just realized there's an outside chance users
> have been passing in things besides instanceobjects and I haven't
> noticed! There isn't a way to parse specifically for an instance
> object the way you can for an int value, or a string object is there?

If you want a string object, use the 'S' modifier. If you want
anything else, you'll have to do a typecheck yourself. To check for
an instanceobject, use the is_instanceobject() macro (only on non-NULL
arguments!).

--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
URL: <http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>