Next / Previous / Contents / Shipman's homepage

8.8. DayNotes.genForms(): Generate forms in phylogenetic order

This Python generator returns the sequence of BirdForm objects in order by the two-part phylogenetic key used in the self._txMap dictionary.

birdnotes.py
# - - -   D a y N o t e s . g e n F o r m s

    def genForms(self):
        """Generate contained forms in phylogenetic order.
        """

        #-- 1 --
        # [ keyList  :=  keys from self.txMap in ascending order ]
        keyList = self._txMap.keys()
        keyList.sort()

        #-- 2 --
        # [ generate the values from self._txMap in order by the
        #   elements of keyList ]
        for  key in keyList:
            yield  self._txMap[key]