[Tutor] Type Checking:/High-Jacking Reserved Words

alan.gauld@bt.com alan.gauld@bt.com
Mon, 5 Mar 2001 11:26:19 -0000


> I would welcome some comments from anyone as to the
> comparative advantages of the following
> >     type(mystr) == types.StringType

This works best if you are checkjing for type several 
times since the import overhead only gets called once.

> >     type(mystr) == type("") 

This is better if you only do it once since the extra 
function call is probably faster than importing the 
type module.

> because the first method necessitates importing another
> module: re: more "overhead".

And the second has the overhead of the second type() 
function call.

Alan g