Skip to content

Commit

Permalink
Update to be inclusive (#176)
Browse files Browse the repository at this point in the history
* Update to be inclusive

I'm named Ali. I struggle with body image, and have my entire life. Can we at least be nice and refer to a pet and maybe not body image issues.

* Update ternary_operators.rst
  • Loading branch information
nyanbinaryneko authored and yasoob committed Sep 13, 2018
1 parent e16804a commit a5102f1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ternary_operators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ expressions.

.. code:: python
is_fat = True
state = "fat" if is_fat else "not fat"
is_nice = True
state = "nice" if is_nice else "not nice"
It allows to quickly test a condition instead of a multiline if
statement. Often times it can be immensely helpful and can make your
Expand All @@ -38,10 +38,10 @@ is some sample code:

.. code:: python
fat = True
fitness = ("skinny", "fat")[fat]
print("Ali is ", fitness)
# Output: Ali is fat
nice = True
personality = ("mean", "nice")[nice]
print("The cat is ", personality)
# Output: The cat is nice
This works simply because True == 1 and False == 0, and so can be done
with lists in addition to tuples.
Expand Down

0 comments on commit a5102f1

Please sign in to comment.