About the implementation of del in Python 3

Ian Kelly ian.g.kelly at gmail.com
Thu Jul 6 12:28:27 EDT 2017


On Thu, Jul 6, 2017 at 9:41 AM, Marko Rauhamaa <marko at pacujo.net> wrote:
> As a good example of the style I'm looking for, take a look at:
>
>    <URL: https://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html>

Java reference types have basically the same concept of identity as
Python objects, so I dug around to find what definition Java uses.
This is what I came up with:

"""
There may be many references to the same object. Most objects have
state, stored in the fields of objects that are instances of classes
or in the variables that are the components of an array object. If two
variables contain references to the same object, the state of the
object can be modified using one variable's reference to the object,
and then the altered state can be observed through the reference in
the other variable.
"""

Also, under the reference equality operator:

"""
At run time, the result of == is true if the operand values are both
null or both refer to the same object or array; otherwise, the result
is false.
The result of != is false if the operand values are both null or both
refer to the same object or array; otherwise, the result is true.
"""

If that language were used for Python, would it suffice for you?



More information about the Python-list mailing list