From 1b3898a4b8f61e959a337bb38ea1ab9c21eefcef Mon Sep 17 00:00:00 2001 From: Hynek Schlawack Date: Sun, 17 Mar 2024 13:35:03 +0100 Subject: [PATCH] Avoid unnecessary assignment/append --- src/attr/_make.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/attr/_make.py b/src/attr/_make.py index 138cda67..0114582a 100644 --- a/src/attr/_make.py +++ b/src/attr/_make.py @@ -2305,9 +2305,7 @@ def _attrs_to_init_script( If *frozen* is True, we cannot set the attributes directly so we use a cached ``object.__setattr__``. """ - lines = [] - if pre_init: - lines.append("self.__attrs_pre_init__()") + lines = ["self.__attrs_pre_init__()"] if pre_init else [] if needs_cached_setattr: lines.append(