Next / Previous / Contents / Shipman's homepage

12.5. BirdForm.__init__()

All the constructor does is save its arguments and establish the class invariants.

birdnotes.py
# - - -   B i r d F o r m . _ _ i n i t _ _

    def __init__(self, dayNotes, birdId, notable=False):
        """Constructor for BirdForm
        """
        #-- 1 --
        self.dayNotes = dayNotes
        self.birdId = birdId
        self.locGroup = None
        self.sightNotes = None
        self.notable = notable
        self._sightingList = []

Add the new BirdForm instance to the parent DayNotes instance. This has to be done after the .birdId attribute has been set up, because the DayNotes container orders its BirdForm children according to the phylogenetic order of their .birdId attributes.

birdnotes.py
        #-- 2
        # [ dayNotes  :=  dayNotes + self ]
        dayNotes.addForm(self)