Next / Previous / Contents / TCC Help System / NM Tech homepage

11.7. TaxonPhotoSet.genForms(): Generate referred FormPhotoSet objects

This method generates the FormPhotoSet objects contained in self, in ascending order by their inverted English name. The code is straightforward: extract the English names that are the keys in the ._formMap dictionary, sort them, and generate the values from the dictionary in that order.

catweb
# - - -   T a x o n P h o t o S e t . g e n F o r m s

    def genForms(self):
        '''Generate self's referred forms.
        '''

        #-- 1
        # [ keyList  :=  the keys from self._formMap, sorted ]
        keyList = self._formMap.keys()
        keyList.sort()

        #-- 2
        # [ keyList is a list of keys in self._formMap ->
        #     generate the values from self._formMap in the
        #     order specified by keyList ]
        for key in keyList:
            yield self._formMap[key]