Well it's a question without a simple answer, it really all depends on what
the task at hand is.
Basically if you are doing something that will have persistent data that
needs to be stored, accessed and modified across various elements and
functions then the use of class structure could be a good way to go. This
will allow you to avoid having each function require 10+ arguments to be
passed.
Use classes when inheritance is needed, also with class structure you could
have multiple copies or states of the same object.

As an example I have a set of tools to deal with the skin clusters. (add and
remove influences, prune, save, load and output information, and etc) Now I
could've written these tools as a set of functions but since they all
operate on the same set of data that is largely interdependent it made more
sense to create a skin cluster class that handled all that information for
me and which methods had an easy way to access all the up to date data they
need to operate on.

Hope this helps,
Serg

On Mon, Jan 18, 2010 at 8:42 PM, Chris Mills <[email protected]> wrote:

> Greetings,
>
> In developing Python scripts for Maya I am wondering when is is
> appropriate to use a set of functions for a script and when it is better
> form to use a class with methods?
>
> Is this a purely semantical difference or are there good arguments for
> why one should go one approach over another?
>
> I am still getting my head around Python and would appreciate hearing
> your thoughts on this.
>
> Kind regards,
> Chris
>
> Lizard Lounge Graphics, LTD.
> Wellington, NZ
> http://lizardlounge.com
>
> Int'l:  +644-977-5400 / +642-174-8770
> NZ local: 04-977-5400 /   021-748-770
>
>
> --
> http://groups.google.com/group/python_inside_maya
>



-- 
TD @ Disney Animation
-- 
http://groups.google.com/group/python_inside_maya

Reply via email to