3 Replies - 706 Views - Last Post: 15 February 2016 - 08:32 AM Rate Topic: -----

#1 jon.kiparsky  Icon User is offline

  • Chinga la migra
  • member icon


Reputation: 10721
  • View blog
  • Posts: 18,354
  • Joined: 19-March 11

Conundrum: False is None is False is... False?

Posted 14 February 2016 - 08:37 PM

Don't ask what I was looking for when I came across this, but:

>>> False is None
False
>>> None is False
False
>>> (False is None) is False
True
>>> False is (None is False)
True
>>> False is None is False
False


Seems to me that either way you group it, that last statement should evaluate to True. Anyone got any clever ideas as to why it's False?

Is This A Good Question/Topic? 0
  • +

Replies To: Conundrum: False is None is False is... False?

#2 DK3250  Icon User is offline

  • Pythonian
  • member icon

Reputation: 326
  • View blog
  • Posts: 1,107
  • Joined: 27-December 13

Re: Conundrum: False is None is False is... False?

Posted 15 February 2016 - 02:19 AM

I read this like (using incorrect notation):
False == None == False

Which equals to:
False is None and None is False

Was This Post Helpful? 3
  • +
  • -

#3 baavgai  Icon User is online

  • Dreaming Coder
  • member icon


Reputation: 6996
  • View blog
  • Posts: 14,635
  • Joined: 16-October 07

Re: Conundrum: False is None is False is... False?

Posted 15 February 2016 - 03:45 AM

Hmm... I perceive an implicit AND, I think.

>>> 1 is 1
True
>>> False is 1 is 1
False
>>> False and True
False
>>> 1 is 1 is 1
True



So, False is None and ...

Oops, just read the above. Um, agree. :P
Was This Post Helpful? 1
  • +
  • -

#4 jon.kiparsky  Icon User is offline

  • Chinga la migra
  • member icon


Reputation: 10721
  • View blog
  • Posts: 18,354
  • Joined: 19-March 11

Re: Conundrum: False is None is False is... False?

Posted 15 February 2016 - 08:32 AM

Quote

False is None and None is False


Makes sense. I suppose this is the tradeoff for having a <= b < c work nicely.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1