I completely agree with Alexander in that this exact code didn't need
to be a class. it doesn't really have an internal state or do anything
that really needs initialization.
BUT, I do recognize that what the OP is trying to do is learn the
language, so providing him with an example of his code in class-form
does help him and move him forward. Now that he sees the syntax, he
can start to investigate why it would or would not benefit from being
a class. As you can see, he only has two functions, and one of them
its basically just a static method.

Being someone that write python code in maya on a daily basis for over
2.5 years, I will say this. I write all my scripts as class structures
for organizational purposes. It happens frequently that I want my
scripts to have options for the way they will be executed, and it
makes having a library of script a lot easier, when I want to use one
as a library component of another script. Its pretty rare that my
tools will only be composed of two functions. But its quite MEL-like
to have all functions and the exported ones are global. In MEL you
aren't saving state, you are just passing around arguments.

When I started learning python over 5 years ago, the friend who was
giving me advice at the time suggested that its pretty much always
cleaner to write your programs as a class. If they really are just
some utility operations they can be functions.

On Jul 28, 8:21 am, Alexander Morano <[email protected]> wrote:
> I think I am failing to understand why this had/has to be a class? Top-
> down, functional programming ain't dead =)
>
> There is nothing more than another layer of encapsulation on this now,
> but no exposed functionality to it.
>
> And I did LOL (sorry) that someone prepended a def class atop this =)
>
> I think my problem stems from the fact you should be initializing the
> class with the eyeObj and whatever other information, and then calling
> eye.rig()
> if you wnated to really start to follow the paradigm of class use/OOP
>
> Cheers.
>
> On Jul 28, 12:34 am, PixelMuncher <[email protected]> wrote:
>
>
>
>
>
>
>
> > Thanks much - this gives me something to build upon.
> > @ Justin:
> > Why did you specify an 'object' param to be passed to the class?

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to