Near the bottom of this PEP you'll see it and maybe it will clear up a few others you might not know about! https://www.python.org/dev/peps/pep-0008/#descriptive-naming-styles
On Saturday, December 9, 2017 at 12:53:31 PM UTC-5, elrond79 wrote: > > Underscores at the start of a variable name are a coding / style > convention - they generally indicate variables that are supposed to be > private or internal. As an end user, you're not "supposed to" access / use > such variables / methods / etc directly - they're there to be used by the > class / api writer maintainer for internal tasks. This generally only > applies to class member, variables - so, "self._sectionWidth". Sometimes > you'll see it with module-level variables, though. (There's really no point > in doing it with variables inside of a function, though, as they already > can't be used outside of that function.) > > Having said that, though, since python doesn't have any "formal" privacy > levels / protections built into the language itself, you can still use them > if you have to. In general, I would say avoid using them if you can (at > the least, try to check if there's other ways to do what you need to do... > it, if there's a "_width" data member, see if there's a "width()" or > "getWidth()" function, or perhaps a "width" property that you can use > instead) - but if there's no other way to do what you need to do, then go > for it. Just be aware that if you DO use such variables, though, you're > opening yourself up to future breakage - ie, the name / usage of any such > members may change abruptly without any notice. > > On Sat, Dec 9, 2017 at 6:13 AM MA07 <[email protected] <javascript:>> > wrote: > >> >> >> On Thursday, December 7, 2017 at 6:42:17 PM UTC, Justin Israel wrote: >> >>> >>> >>> On Fri, Dec 8, 2017, 7:25 AM MA07 <[email protected]> wrote: >>> >>>> hello, >>>> I already google it .however.couldn't really understand why people use >>>> hypen like this. >>>> >>>> sectionWidth=cmds.gettattribute() >>>> >>>> cmds.move(-sectionWidth) <---- in this case. >>>> >>> >>> It has the same meaning in basic math. It negates a numeric value. >>> >>> x = 1 >>> y = -x # -1 >>> y = -1 * x # -1 >>> >>>> -- >>>> 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/1fe39550-331d-4945-b7bc-da6a46fdc000%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/python_inside_maya/1fe39550-331d-4945-b7bc-da6a46fdc000%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >> >> >> no i mean underscore..so sorry .for example , _skyscrapper.. >> _width .why & when to they use it .. >> >> -- >> 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] <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/python_inside_maya/0409ba95-d7ef-414e-b574-ad8d07e6c555%40googlegroups.com >> >> <https://groups.google.com/d/msgid/python_inside_maya/0409ba95-d7ef-414e-b574-ad8d07e6c555%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/13863f4e-8b05-49ea-80f5-53ae5657df7f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
