stv wrote:
> Hmmm, so every Sublocation object has a copy of the grouplocation
> data? 

No, as Danny explained it is a reference to the data, not a copy.

> 
> 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.

There is an intermediate solution as well. You could use a sublocations 
class with attributes but no reference to its parent. Then the above 
would be

for sub in group.sublocations:
if sub.action == 'foo':
  print group.group_location, sub.sublocation

Kent


_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to