Have you heard the one about `is`, `==`, and the £5 note that it’s your pocket?

You may have already come across the fact that `is` and `==` are not the same in Python and cannot be used interchangeably… if you haven’t, you heard it now!

But why? Let’s see what the £5 note has got to do with this story

Let’s assume you and I both have a £5 note in our pocket

[replace with currency of choice]
and
[read “bill” instead of “note” if you wish]

We meet up and go to a coffee shop nearby to buy two coffees which cost £5 altogether

Does it matter which £5 note we use to pay?

/1

[this is like a Netflix series you can binge on, no need to wait until next week for the next episode, read on in the next toot in this thread…]

@folkerschamel if using CPython, as most do. Also, you’ll get a different result if you that in a script rather than the shell/REPL

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.