QuestenaUn entraînement qui indique quoi revoir ensuite
Question 117

Why does x is None distinguish None reliably from other falsy values such as 0 and an empty list?

  1. None is a singleton, so identity singles it out.Bonne réponse
  2. Every falsy value is another spelling of None.
  3. x == False and x is None always mean the same thing.
  4. Identity converts every falsy value to None.

Explication

None has a single shared identity, so the test asks specifically whether x refers to that singleton. General falsiness is broader: zero and an empty list are falsy but are different objects and meanings.

Continuer avec ce test

Commencer l’entraînement
Question 117: Why does x is None distinguish None reliably from other… · Python Fundamentals · Questena