Next / Previous / Contents / Shipman's homepage

8.6. DayNotes.lookupForm()

So that records are retrieved in phylogenetic order, we use a special two-part key for the ._txMap dictionary. This key is fabricated by Section 8.7, “DayNotes._phyloKey(); see its specification function Section 3.1, “phylo-key.

birdnotes.py
# - - -   D a y N o t e s . l o o k u p F o r m

    def lookupForm(self, birdId):
        '''Retrieve the BirdForm for a given kind of bird.
        '''
        #-- 1
        # [ phyloKey  :=  phylo-key(birdId) ]
        phyloKey = self._phyloKey(birdId)

        #-- 2
        # [ if phyloKey is a key in self._txMap ->
        #     return self._txMap[phyloKey]
        #   else -> raise KeyError ]
        return self._txMap[phyloKey]