Next / Previous / Contents / Shipman's homepage

16.4. SightNotes.addPara(): Add a paragraph of notes

The instance's .notes attribute is initially None. If any notes are added, we create a Narrative instance, which is a container for Paragraph objects, and add the new paragraph to it. See Section 18.1, “Narrative.__init__(): Constructor” and Section 18.2, “Narrative.addPara(): Add a paragraph”.

birdnotes.py
# - - -   S i g h t N o t e s . a d d P a r a

    def addPara(self, para):
        """Add a paragraph of notes.
        """
        #-- 1 --
        # [ if self.notes is None ->
        #     self.notes  :=  a new, empty Narrative instance
        #   else -> I ]
        if  self.notes is None:
            self.notes = Narrative()

        #-- 2 --
        # [ self.notes  :=  self.notes with para added as its new
        #                   last element ]
        self.notes.addPara(para)