Skip to content

Commit ba039b2

Browse files
committed
Use itertools.count()
1 parent dfe9f03 commit ba039b2

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

skeleton/generate.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import re
44
from collections.abc import Mapping, Set as AbstractSet
5+
from itertools import count
56
from os import linesep
67
from textwrap import dedent
78
from typing import Annotated, TypeVar, get_args, get_origin
@@ -11,13 +12,11 @@
1112

1213
from .node import Node
1314

14-
_COUNTER = [0]
15+
_COUNTER = count()
1516

1617

1718
def _generate_unique_class_name() -> str:
18-
value = _COUNTER[0]
19-
_COUNTER[0] += 1
20-
return f"_Generated{value}"
19+
return f"_Generated{next(_COUNTER)}"
2120

2221

2322
def _identifier(name: str, /) -> str:

0 commit comments

Comments
 (0)