<commit_before>class FirstClass:
    var_in_all_objects = 0
    def setdata(self, value):
        self.data = value
    def display(self):
        print(self.data)
    def static_method():
        print('static_method')

      
if __name__ == '__main__':
    x = FirstClass()
    y = FirstClass()
    x.setdata("<NAME>")
    y.setdata(3.14159)

    FirstClass.var_in_all_objects = 'abc'
    x.var_in_all_objects = 15
    print(FirstClass.var_in_all_objects)
    print(x.var_in_all_objects)
    print(y.var_in_all_objects)

    x.var_in_all_objects = 'str'
    print(x.var_in_all_objects)

    x.display()
    y.display()

    FirstClass.static_method()

    x.data = "new value"
    x.display()
    
    x.anothername = "spam"
    print(x.anothername)
<commit_msg>[m_lutz-learning_py-5_ed][ch 27] slightly change the first example<commit_after># classes generate multiple instance objects
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()
{'fraction_non_alphanumeric': 0.12187958883994127, 'fraction_numerical': 0.01762114537444934, 'mean_word_length': 2.703804347826087, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '2684758', 'n_tokens_mistral': 498, 'n_tokens_neox': 466, 'n_words': 93}