Skip to content

Commit

Permalink
Tuples are cheaper than lists
Browse files Browse the repository at this point in the history
  • Loading branch information
hynek committed Mar 17, 2024
1 parent 4b1d869 commit 447f8a4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/attr/_make.py
Original file line number Diff line number Diff line change
Expand Up @@ -2252,7 +2252,7 @@ def _determine_setters(frozen, slots, base_attr_map):
"""
if frozen is True:
if slots is True:
return [], _setattr, _setattr_with_converter
return (), _setattr, _setattr_with_converter

# Dict frozen classes assign directly to __dict__.
# But only if the attribute doesn't come from an ancestor slot
Expand All @@ -2278,13 +2278,13 @@ def fmt_setter_with_converter(attr_name, value_var, has_on_setattr):
)

return (
["_inst_dict = self.__dict__"],
("_inst_dict = self.__dict__",),
fmt_setter,
fmt_setter_with_converter,
)

# Not frozen -- we can just assign directly.
return [], _assign, _assign_with_converter
return (), _assign, _assign_with_converter


def _attrs_to_init_script(
Expand Down

0 comments on commit 447f8a4

Please sign in to comment.