Warum funktioniert dies nicht bei Standardklassen?
>>> x = 42 >>> x.a = "not possible to do it" Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'int' object has no attribute 'a'
>>> >>> lst = [34, 999, 1001] >>> lst.a = "forget it" Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'list' object has no attribute 'a'
Es wäre eine Speicherverschwendung für Klassen wie „int“!