an oop question

Chris Angelico rosuav at gmail.com
Thu Nov 3 14:29:25 EDT 2022


On Fri, 4 Nov 2022 at 05:21, Julieta Shem <jshem at yaxenu.org> wrote:
>
> Chris Angelico <rosuav at gmail.com> writes:
>
> > On Thu, 3 Nov 2022 at 21:44, Alan Gauld <learn2program at gmail.com> wrote:
> >> Also Python is not a purely OOP language, in that you can write
> >> functional and procedural code in Python if you wish. In
> >> Smalltalk thats notionally impossible because everything
> >> is an object. And all programming statements are messages
> >> to objects.
> >
> > In Python, everything is an object. Doesn't that equally mean that
> > Python is purely OOP?
>
> I think Alan Gauld pointed out that even syntax is an object in
> Smalltalk --- or was.  An if-statement in Python is not an object.

Okay, fair; although I would be highly surprised if syntax is actually
an object ("flow control is an object", I would believe, though). Is
the concept "pass this message to this object" an object? Is the
message itself an object? Is it objects all the way down?

At some point, any language with objects in it is "object oriented" to
some extent, and after that, it's all a spectrum. Some people claim
that Java is "more object-oriented" than Python because all Java code
has to be in a class, and others counteract by saying that Python is
"more object-oriented" because every value in Python is a subclass of
object and has a type which is a subclass of type. I'm sure that
someone somewhere has claimed that Python "isn't object-oriented" on
the basis that len(x) is the WRONG way to put it, and it should be
x.length() instead.

On second thoughts, it's not a single spectrum, it's a
multidimensional thing that's so tangled up that it guarantees that
people can happily debate for years to come.

ChrisA


More information about the Python-list mailing list