Checking whether bool is a type

Christos TZOTZIOY Georgiou tzot at sil-tec.gr
Sun Jul 27 23:41:39 CEST 2003


On Sun, 27 Jul 2003 23:22:58 +0200, rumours say that Jan Decaluwe
<jan at jandecaluwe.com> might have written:

>In my application I need to know whether bool is 
>available as a type (in Python2.3) or not. I just
>realized I can use the following:

>>> type(bool) is type

You might like to do this as an alternative:

def bool_is_type():
    try:
        return isinstance(bool, type)
    except NameError:
        return 0

to catch older python versions as well.
-- 
TZOTZIOY, I speak England very best,
Microsoft Security Alert: the Matrix began as open source.




More information about the Python-list mailing list