osdir.com


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

About the implementation of del in Python 3


On Fri, Jul 7, 2017 at 6:43 PM, Marko Rauhamaa <marko at pacujo.net> wrote:
> Steve D'Aprano <steve+python at pearwood.info>:
>
>> On Fri, 7 Jul 2017 07:10 am, Marko Rauhamaa wrote:
>>
>>> I believe identity can be defined much better, in numerous isomorphic
>>> ways in fact.
>>>
>>> For example, we could equate each object with a sequence number
>>> (unrelated with its id()). You can define that the "None" object is
>>> in fact the natural number 0. The "False" object is in fact the
>>> natural number 1 etc for all the primordial objects. During the
>>> execution of the program, new objects are created, which simply
>>> associates characteristics to ever higher natural numbers.
>>
>> Hmmm... interesting. You might just be on the right track here. That
>> might even work for "identity" as required by Python.
>>
>> Of course you can't say "equate each object with its sequence number"
>> since that implies that:
>>
>> assert None == 0
>
> Python's integer object 0 might be equated with the (mathematical)
> natural number 18974387634. Python code would have no way of
> introspecting that natural number.
>
> The execution model would determine what properties object 18974387634
> would have.

Then what's the point of that number? If you can't see it from Python
code, it's not part of the language semantics.

ChrisA