type conversion

Hamish McKenzie hamish at valvesoftware.com
Wed Dec 31 21:35:20 CET 2008


sometimes I want to be able to initialize an instance with a variety of different data types.

as an obvious example I might want to initialize a 4x4 matrix with either 16 floats, a list/tuple or 16 floats, another matrix or a quaternion.

is there any other way to do it other than putting case statements in the __init__ method of the class, or having a Matrix.FromQuaternion( quat )?

thx



More information about the Python-list mailing list