[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-list
Subject:    Re: Simple tuple question
From:       "David Fisher" <python () rose164 ! wuh ! wustl ! edu>
Date:       1999-03-21 1:48:27
[Download RAW message or body]

----- Original Message ----- 
From: "Jeff Shipman" <shippy@cs.nmt.edu>
Newsgroups: comp.lang.python
To: <python-list@python.org>
Sent: Monday, March 20, 2000 11:54 AM
Subject: Re: Simple tuple question


> Well, there are two ways you can go about it:
> 
> if type(a) == type(()):
>    print 'yes'
> 
> -or-
> 
> import types
> 
> if type(a) == types.TupleType:
>    print 'yes'
> 

There's a third way, my personal favorite:

import types

if isinstance(a,types.TupleType):
    print 'yes'

dnf


-- 
http://www.python.org/mailman/listinfo/python-list

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic