About the implementation of del in Python 3
On Fri, 7 Jul 2017 06:05 pm, Gregory Ewing wrote:
> Steve D'Aprano wrote:
>> In practice, identity is hardly important in Python, except for a few limited
>> cases, and the prohibition against using `is` when you mean `==`.
> On the contrary, it's a very important concept needed to make
> sense of the way things behave when mutation is involved.
> Witness e.g. the classic newbie mistake of using [*5]*5
> to create a matrix of zeroes. I don't know how to explain
> why that goes wrong without using the phrase "same object"
> in some way.
That would be one of the few limited cases I mentioned :-)
I'll grant you that having the concept of "the same object" can be important.
?Cheer up,? they said, ?things could be worse.? So I cheered up, and sure
enough, things got worse.