On 10/27/07, Alan Gauld <[EMAIL PROTECTED]> 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) > > Alan G. > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor >
or use types module import types if type(n) == types.IntType or type(n) == types.LongType : blah! this comes handy especially for some unique conditions - like whether the function passed is a generator or a normal function (well I kinda had this problem ... :) ) ex. if type(f) == types.GeneratorType or type(f) == types.lambdaType : same blah! -- Aditya
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor