This file contains 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
# following code uses recursion, so it may run out of stack memeory for large collections | |
def flatten(container): | |
"""generate a flatten sequence from the input list""" | |
for i in container: | |
if isinstance(i, (list, tuple)): | |
for j in flatten(i): | |
yield j | |
else: | |
yield i |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
sendJson : Cmd Msg | |
sendJson = | |
let | |
json = | |
Http.jsonBody (Json.Encode.object []) | |
in | |
Http.send SendEmptyJsonMsg | |
(Http.post "api/empty-json" json (Json.Decode.succeed "")) |
OlderNewer