Re: [Tutor] simple question about numeric types

2006-05-08 Thread Kent Johnson
Emanuele Rocca wrote: > Hello list, > I've got a question partially related to this thread. > > * Gregor Lingl <[EMAIL PROTECTED]>, [2006-05-03 0:24 +0200]: >> v= >> if isinstance(v, int) or isinstance(v, float): >> > > I wonder which is the recommended way to check the type of a value.

Re: [Tutor] simple question about numeric types

2006-05-08 Thread Chad Crabtree
I think isinstance() is probably the best way to do this. I however always do type(x)==TestType: where TestType is a string that is returned from type() or not what ever the case. On 5/8/06, Emanuele Rocca <[EMAIL PROTECTED]> wrote: > Hello list, > I've got a question partially related to this t

Re: [Tutor] simple question about numeric types

2006-05-08 Thread Emanuele Rocca
Hello list, I've got a question partially related to this thread. * Gregor Lingl <[EMAIL PROTECTED]>, [2006-05-03 0:24 +0200]: > v= > if isinstance(v, int) or isinstance(v, float): > I wonder which is the recommended way to check the type of a value. In other words, what should I choos

Re: [Tutor] simple question about numeric types

2006-05-02 Thread John Fouhy
On 03/05/06, Gregor Lingl <[EMAIL PROTECTED]> wrote: > Hi! > > Is there a simpler/fster way to check if a value > has int or float type (i.e. is a "real number") than: > > v= > if isinstance(v, int) or isinstance(v, float): > > > (v must not be complex) Well, for one, you can simplify that l

[Tutor] simple question about numeric types

2006-05-02 Thread Gregor Lingl
Hi! Is there a simpler/fster way to check if a value has int or float type (i.e. is a "real number") than: v= if isinstance(v, int) or isinstance(v, float): (v must not be complex) Regards, Gregor -- Gregor Lingl Reisnerstrasse 3/19 A-1030 Wien Telefon: +43 1 713 33 98 Mobil: +43