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

Sheila King sheila@thinkspot.net
Sun, 04 Mar 2001 09:37:18 -0800


It is not necessary to import the types module.

Just try this:

teststr = ""

if type(mystr) == type(teststr):
    pass

People pointed this out yesterday, but perhaps you overlooked it?
I reckon, that this is what the types module does, anyhow.

--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/


On Sun, 4 Mar 2001 08:16:06 -0900, Tim Johnson <tim@johnsons-web.com>  wrote
about Re: [Tutor] Type Checking:/High-Jacking Reserved Words:

:Hey Danny:
:	Thought I'd post my reply back to the list because other
:newbies might want to see your cautionary about 
:what is essentialy "high-jacking" python reserved words.
:
:I would welcome some comments from anyone as to the
:comparative advantages of the following
:>     type(mystr) == types.StringType
:as opposed to
:>     type(mystr) == 'string': 
:because the first method necessitates importing another
:module: re: more "overhead".
:
:Thanks for the heads up Danny!