Danny Yoo wrote: >You may want to change the data structure. > >Rather than have points all be peers, reorganize them so that there's some >kind of hierarchy: that'll help you directly represent the "sharing" of >attributes. Explicitly: > >######################################################### >class Point: > def __init__(self, lat, lon, atts, parent=None): > (self.lat, self.lon, self.atts, self.parent) = ( > lat, long, atts, parent) > def lookup(self, name): > if name in self.atts: > return self.atts[name] > if self.parent: > return self.parent.lookup(name) > raise KeyError >######################################################### > > >
Many thanks Danny. This example was an moment of epiphany for me, one that will probably drastically influence me in the future. I owe you big time! -- Poor Yorick _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor