On Fri, 16 Jan 2009 09:58:53 +0000, Duncan Booth wrote: > That still leaves the question whether anyone has ever actually taken > advantage of this feature. You can do isinstance(x, (IntType, LongType, > StringTypes)) but I didn't even know that StringTypes existed until a > couple of moments ago, and I intend to forget about it again > immediately. Grepping through the Python libraries on my system it looks > like a lot of programmers don't even realise you can combine types into > a tuple.
I do it a lot, except I don't bother with IntType, LongType etc (I assume you imported them from the types module). I just do: isinstance(x, (int, float)) # or whatever -- Steven -- http://mail.python.org/mailman/listinfo/python-list