Each instance of a Taxon object
represents one taxon. These objects make up the tree
representing the taxonomic arrangement.
See Section 9.1, “Class Txny: the complete system” for various ways to obtain
Taxon objects corresponding to a
given scientific name, bird code, or taxonomic key number.
Attributes of a Taxon object:
.txny
A pointer back to the Txny object in
which this taxon is located.
.abbr
The standard bird code, if this taxon has one. Higher ranks such as families and orders may not have a standard code.
.eng
The English name of the taxon, as a string.
.engComma
The English name of the taxon, as a string, but with multi-word names inverted as “last, first”, e.g., “Owl, Great Gray” instead of “Great Gray Owl”.
.parent
For the root taxon, this attribute is None. For the other taxa in the
tree, it points to the taxon that has this taxon as
a child.
.rank
The rank of this taxon, as a Rank
object.
.sci
The scientific name of the taxon, as a string.
.status
The status code for this taxon. For the values of
status codes, see Section 5.2.2, “
Species records in the .std
file
”.
.tex
Normally, this attribute has a value of None. However, if the English name
of this taxon has markup (such as italics or
non-ASCII characters), this attribute may contain
the English name using TEX markup conventions.
.txKey
The taxonomic key number for this taxon.
These methods are available on Taxon objects:
.contains(t2)
If t2 is another
Taxon object in the same
Txny, this predicate tests
whether self contains
t2.
.nearestAncestor(t2)
If t2 is another
Taxon object in the same
Txny, this method returns
the nearest ancestor of self and t2 as a Taxon object.
.childContaining(desc)
If desc is a Taxon
descended from self, this method
returns the child of self that
contains desc.
If desc is not a descendant of self, the method raises ValueError.
.__cmp__(self, other)
This method implements the cmp()
function for comparing two Taxon
objects. The comparison is in phylogenetic order, that is,
the taxon with the lower .txKey
attribute will compare lower.
.__getitem__(self, n)
If 0 <= n < len(self), returns the nth child
of self; otherwise it raises KeyError. This method is called when
a Taxon object t is indexed as “t[n]”.
.__iter__(self)
Defines the iter()
function on a Taxon
element. In constructs such as “for child in taxon”, this
function returns an iterator that visits each child
in order, 0, 1, ....
.__len__(self)
Returns the number of child taxa.