osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

About the implementation of del in Python 3


On Fri, 7 Jul 2017 03:05 am, Marko Rauhamaa wrote:

> I believe the concept of an object is among the more difficult things
> for novice programmers to get.


True, but that has nothing to do with object identity. Inheritance, "is-a"
versus "has-a" relationships, when to write len(x) versus x.len(), those are
more troublesome than identity.

In fact, I would expect that object identity ("sameness") is probably the least
difficult thing for novices to understand. People have an intuitive[1]
understanding of identity based on the properties and behaviour of physical
objects.



[1] It may actually be instinctive -- there are studies that show that even
young babies express surprise when they see something that violates the
intuitive properties of identity. For example, if you pass a toy in front of
the baby, then behind a screen, and swap it for a different toy before showing
it again, babies tend to express surprise. 


-- 
Steve
?Cheer up,? they said, ?things could be worse.? So I cheered up, and sure
enough, things got worse.