Next / Previous / Contents / Shipman's homepage

8.8. birdId.engComma(): Inverted English name

This method returns the English name associated with the form, except that each name has the form “last, first”.

abbr.py
# - - -   B i r d I d . e n g C o m m a   - - -

    def engComma ( self ):
        """Return self's name in 'last, first' order.
        """
        if  self.rel is None:
            eng  =  self.txny.abbrToEng ( self.abbr )
            commafied  =  BirdId.commafy ( eng )
            return "%s%s" % (commafied, self.q)
        else:
            eng1  =  self.txny.abbrToEng ( self.abbr )
            com1  =  BirdId.commafy ( eng1 )
            eng2  =  self.txny.abbrToEng ( self.abbr2 )
            com2  =  BirdId.commafy ( eng2 )
            return ( "%s %s %s%s" %
                     (com1, REL_MAP[self.rel], com2, self.q) )