Commit d44aec5
In the Python 2 and 3 versions of koans/about_true_and_false.py:
self.truth_value(1,) is an integer argument followed by an optional
comma. It just happened to produce the desired answer, because bool(1)
is True.
self.truth_value((1,)) is a tuple argument. Changed the tuple to (0,)
to demonstrate that its truthiness comes from the presence of _any_
elements, and not from the truth value of the element itself.
Also, added an easier example before it --- self.truth_value([0]) ---
to introduce the same idea with the simpler list-literal syntax (no
"magic" comma to worry about).
Finally, changed the whitespace and line wrapping so the Python 2 and 3
files are identical.
Reported by: egonluo
https://github.com/egonluo
Issue gregmalcolm#137:
gregmalcolm#137
1 parent 4e1bb9a commit d44aec5
2 files changed
Lines changed: 8 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
36 | | - | |
37 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
38 | 42 | | |
39 | 43 | | |
0 commit comments