>
> That seems correct to you ?
> I got into the habit of doing that but I may be wrong...

It is absolutely fine to use single underscores for attributes that are
called internally. I was only saying that using double underscores instead
of single ones, will make the attributes 'protected' in the sense that any
subclasses will not be able to override them. In your case, if you are not
subclassing those attributes (or maybe you are not subclassing at all) then
it is fine to use _. But, if you are subclassing, and you want some
attributes to be NOT overridden, then please do not use double underscore.

Anyway, if you want to know more about this please watch this
<https://youtu.be/HTLu2DFOdTg?list=PLRVdut2KPAguz3xcd22i_o_onnmDKj3MA&t=2236>
great talk about python classes from Raymond Hettinger. The above link will
take you exactly to the part where he talks about double underscores but I
highly recommend watching the full talk. It explains in details what you
need to know about classes in python.

On Fri, May 19, 2017 at 10:35 PM, Rémi Deletrain <[email protected]>
wrote:

> Thank you for your comment,
>
> This function is in a class. There are private variables and that are
> called with:
>     - self.origin()
>     - self.set_origin()
>     - self.direction
>     - etc.
>
> That seems correct to you ?
> I got into the habit of doing that but I may be wrong...
>
> --
> 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/b1abb0d9-541e-45cb-acb2-
> 9331073fa91b%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/b1abb0d9-541e-45cb-acb2-9331073fa91b%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/CAPaTLMQX1T9g%2BWC5g0OHhzbTL6o%3DObz%2BaLYEqXyvhmFTpCGSoQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to