Baza znanjaIzpitno središče
SLSlovenščina
Izberi jezik13

CKTIS / Python

Operator is not

Vrne True za različna objekta, tudi če sta njuni vrednosti enaki.

Različica: Python 3.14; repository image, production runtime not attested

Sintaksa

left is not right

Vrne True za različna objekta, tudi če sta njuni vrednosti enaki.

Kopija seznama ima svojo identiteto; drugo ime za isti seznam identiteto ohrani. Metoda __ne__ se ne kliče.

Skladnja

left is not right

is not · id(object)

Primer uporabe

a = []; b = a; c = a.copy()
a is not b → False
a is not c → True

Primeri

records = [8]
alias = records
print(list(records) is not records)
print(alias is not records)

Rezultat

True
False

Metoda __ne__ se ne kliče.

Viri