---
title: "Discussion on \"Why we should not use \"IS\" and use \"==\" in python ?\" | Hashnode"
description: "Discussion on \"Why we should not use \"IS\" and use \"==\" in python ?\". Problem Faced\na = 256\nb = 256\nprint(a is b) # True\n\n\nBut when we try this,\na = 257\nb = 257\nprint(a is b) # False\n\n\nWhy this is strange behaviour ?\nSolution\nIn python, the is keyword is used to test object identity, which checks if two variables refer..."
url: "https://hashnode.com/posts/why-we-should-not-use-is-and-use-in-python/6569cc3ced23e99339e67da6"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Why we should not use "IS" and use "==" in python ?](https://parottasalna.hashnode.dev/why-we-should-not-use-is-and-use-in-python?utm_source=hashnode&utm_medium=feed)

Problem Faced a = 256 b = 256 print(a is b) # True But when we try this, a = 257 b = 257 print(a is b) # False Why this is strange behaviour ? Solution In python, the is keyword is used to test object identity, which checks if two variables refer...

Dec 1, 2023 · 2 min read · parottasalna.hashnode.dev  
Read the article

-   [#python-is](https://hashnode.com/tag/python-is)
-   [#python](https://hashnode.com/tag/python)
-   [#developer](https://hashnode.com/tag/developer)
-   [#iamfullstackdeveloper](https://hashnode.com/tag/iamfullstackdeveloper)
-   [#fullstackdeveloper](https://hashnode.com/tag/fullstackdeveloper)
-   [#developers](https://hashnode.com/tag/developers)
-   [#software-development](https://hashnode.com/tag/software-development)
-   [#pt0](https://hashnode.com/tag/pt0)

## Written by

[Syed Jafer K](https://hashnode.com/@iamsyedjafer)

@iamsyedjafer · Chennai, India

  
[View profile](https://hashnode.com/@iamsyedjafer)

Developer

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
