Last active
February 5, 2021 11:46
-
-
Save gidgid/fdef8b58edac9946f8bdac2af0b14d28 to your computer and use it in GitHub Desktop.
Examples of how more_itertools always_iterable works
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from more_itertools import always_iterable | |
always_iterable([1,3, 5]) # => <list_iterator at 0x107deca30> | |
list(always_iterable([1,3, 5])) # => [1, 3, 5] | |
list(always_iterable({1,3, 5})) # => [1, 3, 5] (works on all iterables) | |
list(always_iterable(42)) # => [42] | |
list(always_iterable([])) # => [] | |
list(always_iterable(None)) # => [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment