Operátoři identity Pythonu
Operátoři identity Pythonu
Identitní operátory se používají k porovnání objektů, nikoli pokud jsou stejné, ale pokud jsou ve skutečnosti stejným objektem se stejným umístěním paměti:
Operator | Description | Example | Try it |
---|---|---|---|
is | Returns true if both variables are the same object | x is y | |
is not | Returns true if both variables are not the same object | x is not y |