Hmmm, so every Sublocation object has a copy of the grouplocation
data? What happens if I come around & change something:

group.grouplocation = differentGroupLocationID

Would I need to (forgive me here if I get some terms wrong) use a
property (or a setter) & then loop over all the affected sublocations
every time grouplocation is re-set? A-la de-normalized relational
database

Is there a better way to skin this cat? Or am I stuck with a) the
non-inner class design & it's ugly indexes

for sub in group.sublocations:
if sub[1] == 'foo':
 print group.group_location, sub[0]

or b) data duplication & possible un-synching.

I'll take a).

On 3/23/06, Kent Johnson <[EMAIL PROTECTED]> wrote:
>
> If you want access to a GroupLocation instance, just pass it to the
> sublocation.
> >
> > class GroupLocation(list):
> >
> >   class _Sublocation(object):
> >     def __init__(self, sublocation, action):
> >       self.sublocation = sublocation
> >       self.action = action
>
>      def __init__(self, grouplocation, sublocation, action):
>        self.grouplocation = grouplocation
>        self.sublocation = sublocation
>        self.action = action
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to