How to determine the bool between the strings and ints?
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Fri Sep 7 21:10:44 EDT 2007
On Fri, 07 Sep 2007 17:40:44 +0200, Jorgen Bodde wrote:
> is the bool derived from 'int' in some way?
Yes.
>>> issubclass(bool, int)
True
> What is the best way to
> check if the config I want to write is an int or a bool ?
if isinstance(value, bool):
print "it's a bool, or a subclass of bool"
elif isinstance(value, int):
print "it's an int, or a subclass of int other than bool"
--
Steven.
More information about the Python-list
mailing list