Skip to content

Commit e176a64

Browse files
Update nodes.py
1 parent d4e35d6 commit e176a64

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

mypy/nodes.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2210,12 +2210,20 @@ def is_star(self) -> bool:
22102210
@mypyc_attr(native_class=False)
22112211
class ArgKinds(list[ArgKind]):
22122212
def __init__(self, values: Iterable[ArgKind] = None) -> None:
2213+
if values is None:
2214+
super().__init__()
2215+
else:
2216+
super().__init__(values)
22132217
self.__count_cache: dict[ArgKind, int] = {}
22142218
self.__index_cache: dict[ArgKind, int] = {}
2219+
self.__positional_only: bool | None = None
22152220

22162221
@property
22172222
def positional_only(self) -> bool:
2218-
return all(kind == ARG_POS for kind in self)
2223+
pos_only = self.__positional_only
2224+
if pos_only is None:
2225+
pos_only = self.__positional_only = all(kind == ARG_POS for kind in self)
2226+
return pos_only
22192227

22202228
@property
22212229
def has_star(self) -> bool:

0 commit comments

Comments
 (0)