"Dave Kuhlman" <[EMAIL PROTECTED]> wrote

> Calling type(n) for any integer seems to return the same object. 
> I checked with id().

I would hope so since they are all of the same type. 
It thus makes sense that they all return a reference to 
the same type object.

> So, should we be using:
> 
>    if type(n) is type(42)

You could, it shouldn't make any difference in this context.

> 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?

'is' or == can make a difference in some cases but I don't 
think this is one of them.

Alan G

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to