an oop question

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Nov 4 03:01:56 EDT 2022


On 4/11/22 12:50 am, Chris Angelico wrote:
> In Python, everything is an object. Doesn't that equally mean that
> Python is purely OOP?

Depends on what you mean by "purely oop". To me it suggests a
language in which dynamically-dispatched methods are the only
form of code. Python is not one of those, because it has
stand-alone functions.

I'm not sure I know of *any* language that is purely oop in
that sense. Smalltalk probably comes the closest, but then its
code blocks are essentially lexically-scoped anonymous functions.
You *could* write Smalltalk code in a procedural style by
assigning a bunch of code blocks to names and calling them like
functions. Not that there would be any reason to do that other
than as a party trick.

Java looks like it's fairly purely OO at first glance, but it
has static methods, which are really stand-alone functions by
another name. Also it has some primitive types such as ints
and floats that don't behave in an OO way at all.

-- 
Greg


More information about the Python-list mailing list