Rob Cowie wrote: > KraftDiner wrote: > > I have the following code... > > > > import array > > len32 = array.array('L') > > len16 = array.array('H') > > > > len32.append(0) > > len16.append(0) > > > > y = len32[0] > > print y.__class__ > > <type 'long'> > > z = len16[0] > > print z.__class__ > > <type 'int'> > > > > how can I change Zs type to long? > > z_long = long(z) > type(z_long) > <type 'long'> > > > Or how how can I change an arrays type?
In C++ you can cast one class type to another if you override the operator= Then you can convert one class type to another... In Python it would appear that the left hand side of the assignment operator is not used to determine if a cast is necessary. So how would I do this in python? a = classA() b = classB() b = a In the end b would end up just being a refrence to a no conversion would have been done. -- http://mail.python.org/mailman/listinfo/python-list