On Sat, Oct 27, 2007 at 01:03:18PM +0100, Alan Gauld wrote: > > "Dick Moores" <[EMAIL PROTECTED]> wrote > > > if type(n) == 'int' or type(n) == 'long': > > do something > > don't use strings > > if type(n) == int > > Or just use an instance of the same type: > > if type(n) == type(42)
Calling type(n) for any integer seems to return the same object. I checked with id(). So, should we be using: if type(n) is type(42) or, as suggested by Aditya Lal in another message in this thread: import types if type(n) is types.IntType Or, is this a frivolous question that makes no difference? Dave > > Alan G. > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor -- Dave Kuhlman http://www.rexx.com/~dkuhlman _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor