diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2017-01-11 16:24:02 -0800 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2017-01-11 16:36:58 -0800 |
commit | f39bd61e279ead7106a1272b653bc2e64c6fd452 (patch) | |
tree | 4ddec18322b5304daef3e10a55ad89fd8d52f10f /alot/__main__.py | |
parent | 4645c4b2eb2b3aa93305f0c10fd3567cfeeb41c7 (diff) |
Replace None passed to comprehensions with identity function
One of the differences between map/filter and a comprehension is what
happens with None. For map and filter passing None as the function will
be treated as an identity function (equivalent to lambda x: x), for
comprehensions however, this will raise an exception (calling NoneType).
The fix is rather simple, instead of making the default of filtfun None,
make it an identity function. I've used lambda x: x since it's easy,
although defining an identity function in a utility library might be
preferable since lambdas are slower than normal functions.
Fixes #946
Diffstat (limited to 'alot/__main__.py')
0 files changed, 0 insertions, 0 deletions