You are returning a cross product when smooth is false. A cross product is
a vector. Also as I said before, your example does not show implementation of
getCrossProduct() so it is not clear what actually you are returning. But
again, as I mentioned earlier, if your method name is getCrossProduct()
then it _should_ return an MVector. As to how can you tell what it is
returning, as part of the debugging process, you can always check with
type() but remember type will only return the immediate (the class) but it
will not cover the inheritance. To check that you have to use isinstance().

Here is an example:

>>> class Test1 (object):
        pass>>> class Test2 (Test1):
        pass>>> a = Test1()>>> b = Test2()>>> type(a) is Test1True>>>
type(b) is Test2True


>>> type(b) is Test1False


>>> isinstance(b, Test1)True>>> isinstance(b, Test2)True>>> isinstance(a, 
>>> Test1)True>>> isinstance(a, Test2)False>>> isinstance([], list)True>>> 
>>> isinstance({}, dict)True


On Wed, Jul 27, 2016 at 1:04 AM, likage <[email protected]> wrote:

> I would comment on the second part of your question :
>> Regarding the getNormal() method, the short answer is yes. To write clean
>> readable code, the only thing that is of importance (more so in python) is
>> to name your methods, variable with utmost care. Since getNormal() would
>> return a MVector in both cases (and here I am assuming that your
>> getCrossProduct() method returns a MVector) it is fine to write that code.
>> With the name "getNormal" you are making a promise that the method will
>> return a 'normal' (which here semantically means MVector), as long as you
>> keep that promise, it is acceptable by all means.
>>
>
> Okay, while I understand what you are saying but (this may sounds stupid
> of me) when smooth is True, I thought it will return a MVector while False,
> it will return MPoint?
> Rather, how can I tell what does it returns?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/2b8e970c-a83b-424c-b794-11939e87853e%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/2b8e970c-a83b-424c-b794-11939e87853e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



--

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPaTLMSPpxVHtY3w_nEaK%2BV7hW05wvDiekEU8e%3D8TtL3kyJkwQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to