Amateur question on class definitions...

J. Marc Edwards jmarcedwards at gmail.com
Tue Nov 29 10:21:52 EST 2011


So I am defining my Python classes for a Django data model.  I have a
the following class hierarchy and would value some expert input on how
to best implement this.

I have many instances of a particular class which I call a "workflow",
e.g. wf_1, wf_2, wf_3, etc.
These class instances of workflows can be combined into "composite
workflows", e.g. {cwf_1 is comprised of wf1 & wf_3}, {cwf_2 is wf_2 and
wf_3}, or {cwf_3 is just wf_2}, etc.
The workflows that constitute the composite workflow is positionally
dependent, i.e. if cwf_1 is comprised of wf_1 and wf_3, then wf_1 comes
1st AND wf_3 is 2nd.
As I have many workflow instances that accumulate in my persistent
database (Django data model), then the composite workflows become an
ordered collection of workflow instances.

My first thought here is that the composite workflow class should have a
field that is a simple list of workflows, i.e. list(workflows), but I am
somewhat unsure of how to code this correctly.

Here is a sample pseudo-code...

class a_workflow(models.Model):
...

class composite_workflow(models.Model):
    ...a list of "a_workflows", i.e. a composite workflow, should I use
this syntax?
    set_of_workflows = list(a_workflow)

Is this how a pro would do this?

Regards, Marc
-- 

J. Marc Edwards
Lead Architect - Semiconductor Design Portals
Nimbis Services, Inc.
Skype: (919) 747-3775
Cell:  (919) 345-1021
Fax:   (919) 882-8602
marc.edwards at nimbisservices.com
www.nimbisservices.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20111129/0402d1c7/attachment.html>


More information about the Python-list mailing list