<commit_before># the "classes generate multiple instance objects" section
def example_01(): 
    print("example 01 (classes generate multiple instance objects) =>")

    class FirstClass:
        def setdata(self, value):
            self.data = value
        def display(self):
            print(self.data)

    x = FirstClass()
    y = FirstClass()

    x.setdata("<NAME>")
    y.setdata(3.14159)

    x.display()
    y.display()

    x.data = "New value"
    x.display()

    x.anothername = "spam"


if __name__ == '__main__':
    example_01()<commit_msg>[m_lutz-learning_py-5_ed][ch 27] add code for the "inheritance" section<commit_after># the "classes generate multiple instance objects" section
def example_01(): 
    print("example 01 (classes generate multiple instance objects) =>")

    class FirstClass:
        def setdata(self, value):
            self.data = value
        def display(self):
            print(self.data)

    x = FirstClass()
    y = FirstClass()

    x.setdata("<NAME>")
    y.setdata(3.14159)

    x.display()
    y.display()

    x.data = "New value"
    x.display()

    x.anothername = "spam"


# the "classes are customized by inheritance" section
def example_02():
    print("example 02 (classes are customized by inheritance) =>")

    class FirstClass:
        def setdata(self, value):
            self.data = value
        def display(self):
            print(self.data)

    class SecondClass(FirstClass):
        def display(self):
            print('Current value = "%s"' % self.data)

    z = SecondClass()
    z.setdata(42)
    z.display()


if __name__ == '__main__':
    example_01()
    example_02()
{'fraction_non_alphanumeric': 0.12356147789218655, 'fraction_numerical': 0.021199273167777106, 'mean_word_length': 2.5223880597014925, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2409729', 'n_tokens_mistral': 542, 'n_tokens_neox': 494, 'n_words': 135}