CKTIS / Python
Operador is not
Devuelve True para objetos distintos, aunque sus valores sean iguales.
Versión: Python 3.14; repository image, production runtime not attested
Sintaxis
left is not rightDevuelve True para objetos distintos, aunque sus valores sean iguales.
Una lista copiada tiene identidad propia; asignar otro nombre a la misma lista conserva su identidad. __ne__ no interviene.
Sintaxis
left is not right
is not · id(object)
Ejemplo de uso
a = []; b = a; c = a.copy()
a is not b → False
a is not c → True
Ejemplos
records = [8]
alias = records
print(list(records) is not records)
print(alias is not records)
Resultado
True False
__ne__ no interviene.