Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Answer

Post Timeline

Commonmark migration
Source Link

If uses short circuit boolean evaluation to find the first non-null string in the list. For strings, the empty string '' evaluates to False and everything other string is regarded as a True value.

Sections 5.1 and 5.2 from the documentation tell you all you need to know to understand this.

In particular:

x or y if x is false, then y, else x

This is a short-circuit operator, so it only evaluates the second argument if the first one is False.

If uses short circuit boolean evaluation to find the first non-null string in the list. For strings, the empty string '' evaluates to False and everything other string is regarded as a True value.

Sections 5.1 and 5.2 from the documentation tell you all you need to know to understand this.

In particular:

x or y if x is false, then y, else x

This is a short-circuit operator, so it only evaluates the second argument if the first one is False.

If uses short circuit boolean evaluation to find the first non-null string in the list. For strings, the empty string '' evaluates to False and everything other string is regarded as a True value.

Sections 5.1 and 5.2 from the documentation tell you all you need to know to understand this.

In particular:

x or y if x is false, then y, else x

This is a short-circuit operator, so it only evaluates the second argument if the first one is False.

Source Link
David Heffernan
  • 616.4k
  • 46
  • 1.1k
  • 1.5k

If uses short circuit boolean evaluation to find the first non-null string in the list. For strings, the empty string '' evaluates to False and everything other string is regarded as a True value.

Sections 5.1 and 5.2 from the documentation tell you all you need to know to understand this.

In particular:

x or y if x is false, then y, else x

This is a short-circuit operator, so it only evaluates the second argument if the first one is False.

lang-py

AltStyle によって変換されたページ (->オリジナル) /