Skip to content
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

Use literal syntax instead of function calls to create the data structure #4038

Merged
merged 3 commits into from
May 6, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ Internal Changes
``all``, ``any``, ``enumerate``, ``sum``, ``tuple`` etc. can work directly with a
generator expression. (:pull:`4026`)
By `Prajjwal Nijhara <https://github.com/pnijhara>`_.
- Use literal syntax instead of function calls to create the data structure
It is slower to call e.g. list() than using the empty literal, because the name list
must be looked up in the global scope in case it has been rebound. (:pull:`4038`)
By `Prajjwal Nijhara <https://github.com/pnijhara>`_.
pnijhara marked this conversation as resolved.
Show resolved Hide resolved

.. _whats-new.0.15.1:

Expand Down
2 changes: 1 addition & 1 deletion xarray/core/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ def merge(
from .dataarray import DataArray
from .dataset import Dataset

dict_like_objects = list()
dict_like_objects = []
for obj in objects:
if not isinstance(obj, (DataArray, Dataset, dict)):
raise TypeError(
Expand Down
2 changes: 1 addition & 1 deletion xarray/util/print_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def show_versions(file=sys.stdout):
("sphinx", lambda mod: mod.__version__),
]

deps_blob = list()
deps_blob = []
for (modname, ver_f) in deps:
try:
if modname in sys.modules:
Expand Down