Merge pull request #256 from chrismilson/all-true-ation-readability

Update explanation for All-true-ation
This commit is contained in:
Satwik Kansal 2021-02-18 12:53:58 +00:00 committed by GitHub
commit d6ba3a66a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

4
README.md vendored
View File

@ -1273,8 +1273,8 @@ Why's this True-False alteration?
```
- `all([])` returns `True` since the iterable is empty.
- `all([[]])` returns `False` because `not []` is `True` is equivalent to `not False` as the list inside the iterable is empty.
- `all([[[]]])` and higher recursive variants are always `True` since `not [[]]`, `not [[[]]]`, and so on are equivalent to `not True`.
- `all([[]])` returns `False` because the passed array has one element, `[]`, and in python, an empty list is falsy.
- `all([[[]]])` and higher recursive variants are always `True`. This is because the passed array's single element (`[[...]]`) is no longer empty, and lists with values are truthy.
---