Skip to content

Commit c6f180c

Browse files
lul-casjohnslavik
andcommitted
gh-65058: Use True/False and spam/eggs/ham in the grouping example
Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
1 parent 25f6b49 commit c6f180c

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎Doc/reference/expressions.rst‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2426,10 +2426,10 @@ evaluated and its value is returned.
24262426
Conditional expressions group from right to left, so
24272427
``a if b else c if d else e`` means ``a if b else (c if d else e)``::
24282428

2429-
>>> 'foo' if 1 else 'bar' if 0 else 'baz'
2430-
'foo'
2431-
>>> ('foo' if 1 else 'bar') if 0 else 'baz'
2432-
'baz'
2429+
>>> 'spam' if True else 'eggs' if False else 'ham'
2430+
'spam'
2431+
>>> ('spam' if True else 'eggs') if False else 'ham'
2432+
'ham'
24332433

24342434
See :pep:`308` for more details about conditional expressions.
24352435

0 commit comments

Comments
 (0)