Open
Description
When I use curl cheat.sh/python/filter
The output is shown below, it does not have any instances, what should I do to get some use cases of this function in cheat.sh?
And I think some contents are outdated already
# You can read about the changes in [What's New In Python
# 3.0](http://docs.python.org/3.0/whatsnew/3.0.html). You should read it
# thoroughly when you move from 2.x to 3.x since a lot has been changed.
#
# The whole answer here are quotes from the documentation.
#
# **[Views And Iterators Instead Of
# Lists](http://docs.python.org/3.0/whatsnew/3.0.htmlviews-and-
# iterators-instead-of-lists)**
#
# > Some well-known APIs no longer return lists:
# >
# > - [...]
# > - [`map()`](http://docs.python.org/3.0/library/functions.htmlmap)
# and
# [`filter()`](http://docs.python.org/3.0/library/functions.htmlfilter)
# return iterators. If you really need a list, a quick fix is e.g.
# `list(map(...))`, but a better fix is often to use a list
# comprehension (especially when the original code uses lambda), or
# rewriting the code so it doesn’t need a list at all. Particularly
# tricky is `map()` invoked for the side effects of the function; the
# correct transformation is to use a regular `for` loop (since creating
# a list would just be wasteful).
# > - [...]
#
# **[Builtins](http://docs.python.org/3.0/whatsnew/3.0.htmlbuiltins)**
#
# > - [...]
# > - Removed `reduce()`. Use [`functools.reduce()`](http://docs.python.
# org/3.0/library/functools.htmlfunctools.reduce) if you really need
# it; however, 99 percent of the time an explicit `for` loop is more
# readable.
# > - [...]
#
# [nhahtdh] [so/q/13638898] [cc by-sa 3.0]
Metadata
Metadata
Assignees
Labels
No labels