A question about funcation parameter and self defined object

Wei Guo weiguo6 at gmail.com
Wed Oct 8 19:36:44 EDT 2008


Hi,

I defined a class called vec3 which contains x, y, z and in another
function, I tried to call a function which takes a vec3 as a parameter, but
it seems that parameter is passed as a generic object and I can not access x
, y, z in my vec3. Could anyone help me with that?

 class vec3:
    def __init__(self, x_ = 0.0, y_ = 0.0, z_ = 0.0):
        self.x = x_
        self.y = y_
        self.z = z_
class mat4:
         def translation( traV = vec3() ):
              tranM.rowLst[index][0] = traV.x
AttributeError: 'NoneType' object has no attribute 'x'

Could anyone help me how to turn the traV as type of vec3() instead of
NoneType object?

Thanks a lot,

Wei
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20081008/71042e5f/attachment.html>


More information about the Python-list mailing list