News for hackers. Stuff that matters.
Re:OO in Python is mostly pointless by pansa2 on Wednesday January 27, 2021 @06:46PM (#25935799)
We can inherit from `list`, `dict` etc., but objects of those classes are still not as flexible as "normal" objects. For example, we can't add an attribute to a list using `l = []; l.a = 1`.
Re:OO in Python is mostly pointless by joshuamorton on Wednesday January 27, 2021 @07:06PM (#25936047)
I believe that makes them the same as any other class defined with `__slots__`:

    >>> class Foo:
    ...   __slots__ = ('a', 'b')
    ...
    >>> f = Foo()
    >>> f.a = 1
    >>> f.b = 2
    >>> f.c = 3
        Traceback (most recent call last):
          File "<stdin>", line 1, in <module>
        AttributeError: 'Foo' object has no attribute 'c'