'is not' or '!='

Marko Rauhamaa marko at pacujo.net
Tue Aug 19 19:02:33 EDT 2014


Ian Kelly <ian.g.kelly at gmail.com>:

> On Tue, Aug 19, 2014 at 3:00 PM, Marko Rauhamaa <marko at pacujo.net> wrote:
>> For a more worthy attempt, we'll have to take a look at Scheme (<URL:
>> http://www.scheme.com/tspl2d/objects.html>):
>
> Those are invariants, not a definition.  The actual definition is
> found in the paragraph above:
>
> "In most Scheme systems, two objects are considered identical if they
> are represented internally by the same pointer value and distinct (not
> identical) if they are represented internally by different pointer
> values, although other criteria, such as time-stamping, are possible."
>
> In other words, object identity in Scheme is also established by an
> integer that may or may not correspond to a memory address. How is
> this any different from Python's definition?

"In most Scheme systems" is similar to the CPython sidenote. The
"invariants" might not form a complete axiom system but are a step in
that direction.

When Peano Arithmetic posits (<URL:
http://en.wikipedia.org/wiki/Peano_axioms#Addition>):
   
   a + 0 = a
   a + b' = (a + b)'

we usually take that to be the definition of addition in the system.

The true Scheme standard appeals to the "invariants" (<URL:
http://www.schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-9.ht
ml#%_sec_6.1>):

    The eqv? procedure defines a useful equivalence relation on objects.
    Briefly, it returns #t if obj1 and obj2 should normally be regarded
    as the same object. This relation is left slightly open to
    interpretation, but the following partial specification of eqv?
    holds for all implementations of Scheme.

    The eqv? procedure returns #t if:

       obj1 and obj2 are both #t or both #f.

       obj1 and obj2 are both symbols and

       (string=? (symbol->string obj1)
                 (symbol->string obj2))
                   ===>  #t

    [...]


Marko



More information about the Python-list mailing list