object types, mutable or not?

Ned Batchelder ned at nedbatchelder.com
Wed May 16 09:23:02 EDT 2018


On 5/16/18 3:17 AM, Steven D'Aprano wrote:
> On Wed, 16 May 2018 17:03:22 +1000, Ben Finney wrote:
>
>> So, no, I think the more useful – and less problematic – framing is that
>> every object *has* a value, and mutable objects may change to a
>> different value while remaining the same object.
> What's an object?
>
> That's not a rhetorical question. When I started learning Python, I had
> *no idea* what "object oriented programming" was, or what classes and
> objects and instances were. I still don't know if there is a precise,
> accurate, unambiguous definition.
>
> If you're going to describe Python in terms of objects for pedagogical
> purposes, you better be prepared to explain in simple, plain English, non-
> technical, unambiguous terms what an object is. Without reference to the
> CPython (or any other Python) implementation.
>
> It is true that "value" has a multitude of meanings. But "object" is even
> worse. Not only does it also have a multitude of meanings (Websters lists
> at least 7 for the noun, WordNet gives 5), but it ALSO has a technical
> meaning in computer science, AND a specific meaning in Python as the name
> of the type "object", AND also is used as a synonym for "instance".
>
> I expect that most people understand that the ordinary English word
> "value" has a multitude of meanings, and so will avoid thinking of it as
> a precise technical term. I don't think you can say the same for "object".
>
>

I've also experimented with different ways to better say "everything is 
an object".  One possibility is, "any right-hand side of an assignment 
is an object," though that is a bit tortured.

Now I'm thinking of trying, "Any piece of data is an object."  I think 
that might work well, with some complications arising when you have to 
explain that functions (and modules and classes and ...) are also a kind 
of data.  At least it will let me use the word "data" so I can pretend 
to be one of the cool kids :)

--Ned.



More information about the Python-list mailing list