Identity Operators (पहचान ऑपरेटर) :-
Identity Operators (पहचान ऑपरेटर) वे Operators हैं जिनका उपयोग यह जाँचने के लिए किया जाता है कि दो variables एक ही object (वस्तु) को refer (संदर्भित) कर रहे हैं या नहीं।
Python में Identity Operators object की identity को compare करते हैं, केवल उनकी value को नहीं।
Identity Operators का result हमेशा Boolean value (True या False) होता है।
English
Identity Operators are used to check whether two variables refer to the same object in memory or not.
They compare the identity of objects, not simply their values.
Identity Operators always return a Boolean value (True or False).
Types of Identity Operators
Python में मुख्य रूप से 2 Identity Operators होते हैं:
1. is Operator – एक ही Object है
The is operator checks whether two variables refer to the same object.
is Operator यह जाँचता है कि दो variables एक ही object को refer कर रहे हैं या नहीं।
यदि दोनों variables एक ही object को refer करते हैं, तो result True होता है।
अन्यथा result False होता है।
The is not operator checks whether two variables do not refer to the same object.
is not Operator यह जाँचता है कि दो variables एक ही object को refer नहीं करते हैं।
यदि दोनों variables अलग-अलग objects को refer करते हैं, तो result True होता है।
Syntax:-