Skip to content

MAINT Use list and dict comprehension #23894

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Nov 29, 2018

Conversation

rth
Copy link
Contributor

@rth rth commented Nov 25, 2018

This uses list and dict comprehension in places where it doesn't hurt readability. It should be a bit faster and less verbose.

Copy link
Member

@datapythonista datapythonista left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fixes, thanks for taking care of them.

Just added a comment that IMO would improve readability, but lgtm.

# handle sets, no slicing
r = [
pprint_thing(
next(s), _nest_lvl + 1, max_seq_items=max_seq_items, **kwds)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

personally I think it'd be a bit more readable like:

r = [pprint_thing(next(s),
                  _nest_lvl + 1,
...

@datapythonista datapythonista added Performance Memory or execution speed performance Code Style Code style, linting, code_checks Clean labels Nov 25, 2018
@codecov
Copy link

codecov bot commented Nov 25, 2018

Codecov Report

Merging #23894 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #23894      +/-   ##
==========================================
- Coverage   92.31%    92.3%   -0.01%     
==========================================
  Files         161      161              
  Lines       51471    51431      -40     
==========================================
- Hits        47515    47475      -40     
  Misses       3956     3956
Flag Coverage Δ
#multiple 90.7% <100%> (-0.01%) ⬇️
#single 42.44% <35.29%> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/groupby/ops.py 96.77% <100%> (-0.03%) ⬇️
pandas/plotting/_core.py 83.58% <100%> (-0.05%) ⬇️
pandas/core/config.py 87.04% <100%> (-0.13%) ⬇️
pandas/core/dtypes/concat.py 96.63% <100%> (-0.04%) ⬇️
pandas/core/computation/align.py 97.84% <100%> (-0.05%) ⬇️
pandas/core/sparse/frame.py 94.83% <100%> (-0.03%) ⬇️
pandas/io/formats/style.py 96.67% <100%> (-0.03%) ⬇️
pandas/core/internals/blocks.py 93.69% <100%> (-0.02%) ⬇️
pandas/core/panel.py 97.91% <100%> (-0.02%) ⬇️
pandas/io/formats/printing.py 93.01% <100%> (-0.08%) ⬇️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ee283fa...b95cad4. Read the comment docs.

@jreback
Copy link
Contributor

jreback commented Nov 27, 2018

can you merge master, ping on green.

@pep8speaks
Copy link

Hello @rth! Thanks for updating the PR.

@rth
Copy link
Contributor Author

rth commented Nov 27, 2018

Thanks @datapythonista ! Addressed your comment.

@jreback Merged master in and CI is green.

@jreback jreback added this to the 0.24.0 milestone Nov 29, 2018
@jreback jreback merged commit 295703b into pandas-dev:master Nov 29, 2018
@jreback
Copy link
Contributor

jreback commented Nov 29, 2018

thanks @rth

Pingviinituutti pushed a commit to Pingviinituutti/pandas that referenced this pull request Feb 28, 2019
Pingviinituutti pushed a commit to Pingviinituutti/pandas that referenced this pull request Feb 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean Code Style Code style, linting, code_checks Performance Memory or execution speed performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants