Set type?

Fredrik Lundh fredrik at pythonware.com
Thu Jan 4 13:57:22 EST 2007


_ wrote:

> How do you check to see if a variable is a set?  I would like to use
> 
> if type(var) is types.SetType:
>    blah
> 
> but that is not available in types module.  I am using 2.4

     # set or subclass of set
     if isinstance(var, set):
         ...

     # exact match
     if type(var) is set:
         ...

also see

     http://preview.tinyurl.com/yjnoc5

</F>




More information about the Python-list mailing list