Next / Previous / Contents / Shipman's homepage

11.12. BirdId.__str__()

Displays a BirdId instance in string form.

abbr.py
# - - -   B i r d I d . _ _ s t r _ _   - - -

    def __str__ ( self ):
        """Display the English name of self.
        """

        #-- 1 --
        # [ if self.rel == REL_SIMPLE ->
        #     return the .eng attribute of self.abbr's Taxon
        #   else ->
        #     return the .eng attributes of the Taxon instances of
        #     self.abbr and self.abbr2, separated by self.rel in
        #     conventional form ]
        if  self.rel == REL_SIMPLE:
            eng = self.txny.abbrToEng ( self.abbr )
            return "%s%s" % (eng, self.q)
        else:
            eng1 = self.txny.abbrToEng ( self.abbr )
            eng2 = self.txny.abbrToEng ( self.abbr2 )
            return ( "%s %s %s%s" %
                     ( eng1, self.rel, eng2, self.q ) )