On Sun, 5 Jun 2016 10:35 AM Rudi Hammad <[email protected]> wrote:
> > >> If you have a class with only 2 methods, and one of them is __init__(), >> then you actually want a function: Stop Writing Classes >> <https://www.google.co.nz/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&uact=8&ved=0ahUKEwj93brXr4_NAhWh5aYKHcr2A9kQtwIIIzAB&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D5ZKvwuZSiyc&usg=AFQjCNFmZVxxwQizSaiWoIvyttCxF7eNsQ&sig2=KdZ31zIBfmhaOxVsVG14DA> >> >> That was just an example, of course I have a lot of methods. It was just > to understand if using in the __init__ the args "side" and "name" is okey., > because the rest of the methods use those variables > at some point. > Oh ok. Then sure, those seem fine. If they are the required variables that drive the functionality of the other methods then it makes sense to be able to construct and instance with them. > They way I am wrote my last code to do the tool in the reel I linked is: > 1. coreTools class that has methods to gets distances, vectors, > vertexcountes etc..etc..so generic stuff you use usally > 2. then in another module I have a jointTools class, that has methods to > do basic rigging stuff, like iks, fk/ik, etc... > 3. a more detailed class that inherits from joint jointTools class to make > methods like softIk, stretchyIk, bendings etc..etc... > > Is this approach correct for OOP? > If coreTools class needs state for each instance, then sure. If it's just a bunch of utility methods that don't access "self" other than than to call another method, then maybe not. And coreTools would be expected to be CoreTools if it's a class ;-) > thanks for the tuple() and _private tips > > -- > 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/81667cab-892c-4e07-a0e7-e3c989a7fbdc%40googlegroups.com > <https://groups.google.com/d/msgid/python_inside_maya/81667cab-892c-4e07-a0e7-e3c989a7fbdc%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/CAPGFgA0pP_osCvdF_uqaFo3V-U-Df-nsZrqEEYQhTurwRsNiDQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
