News for hackers. Stuff that matters.
Re:OO in Python is mostly pointless by dfinninger on Wednesday January 27, 2021 @05:48PM (#25935231)
Just to discuss one point:

> And why are some classes (int, str, float) allowed to be lower case

Also, boolean. These are primitive data types. For instance, in Java there's a difference between int and Integer. I'd assume that Python special-cases these because they are primitive. But I haven't been through the Python internals, so it's only a guess.

Re:OO in Python is mostly pointless by bobbyi_settv on Wednesday January 27, 2021 @08:39PM (#25936979)
It's just for historical/ backwards compatibility reasons. These types have been part of Python from before it had classes. Today, they are classes and can be subclassed, etc, but too much code relies on their existing names to change them to match the modern convention.
Re:OO in Python is mostly pointless by rbanffy on Wednesday January 27, 2021 @05:59PM (#25935341)
They are far less primitive than Java's - they are classes too, but can't be extended.
Re:OO in Python is mostly pointless by BerislavLopac on Wednesday January 27, 2021 @06:14PM (#25935484)
I'm not sure which language did you mean there, but in Python those classes can be extended.

Also, the main reasons for special cases are historical; also, they predate PEP8 by a long time.

Re:OO in Python is mostly pointless by rbanffy on Wednesday January 27, 2021 @06:23PM (#25935589)
Sorry. That's something that was true in 2.x but not anymore. There used to be UserString, UserList, UserDict classes for serving as base classes. We still have those, but, at least now, we can extend the fundamental classes directly.

They are a bit more convenient than the built-ins.

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'