This method is used to find the effective locality data
when one element inherits locality from a parent element.
For design notes on the inheritance process, see
Section 13.2, “Sighting.getLocGroup(): Find a
sighting's effective locality”.
# - - - L o c G r o u p . i n h e r i t
def inherit(self, parentGroup):
"""Implement locality inheritance.
"""
Here, we make heavy use of Python's “” operator to set a value to
A or B if A is not ANone, or to if B is ANone.
#-- 1 --
# [ if self.loc is None ->
# loc := parentGroup.loc
# else ->
# loc := self.loc ]
loc = self.loc or parentGroup.loc
#-- 2 --
# [ simile ]
gps = self.gps or parentGroup.gps
locDetail = self.locDetail or parentGroup.locDetail
See Section 14.1, “LocGroup.__init__()”.
#-- 3 --
return LocGroup(loc, gps, locDetail)