[Tutor] Class causing segmentation fault???

Daniel Yoo dyoo@hkn.EECS.Berkeley.EDU
Sat, 22 Jul 2000 12:40:52 -0700 (PDT)

> Replacing this with:
>    if type(v1Value)==type(1) or type(v1Value)==type(1.0)
> solved the problem.  Thanks muchly!

Sure, no problem.  One other thing you'll probably want to do is make sure
you're taking care of the Long integer type too.

Here's a convoluted function to check for numeric types.  For fun, I'm
using the 'types' module and isinstance() function:

def isNumeric(x):
  from types import IntType, LongType, FloatType, ComplexType
  numerics = [IntType, LongType, FloatType, ComplexType]
  for n in numerics:
    if isinstance(x, n):
      return 1
  return 0