Skip to content

Commit 2a10ba4

Browse files
committed
Make DelimitedList generic on _S, since it can actually contain any object than can be converted into a string.
1 parent e44f45e commit 2a10ba4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

domdf_python_tools/stringlist.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
# stdlib
3131
from contextlib import contextmanager
32-
from typing import Any, Iterable, Iterator, List, Tuple, Union, cast, overload
32+
from typing import Any, Iterable, Iterator, List, Tuple, TypeVar, Union, cast, overload
3333

3434
# this package
3535
from domdf_python_tools.doctools import prettify_docstrings
@@ -38,6 +38,8 @@
3838

3939
__all__ = ["Indent", "StringList", "DelimitedList"]
4040

41+
_S = TypeVar("_S")
42+
4143

4244
@prettify_docstrings
4345
class Indent:
@@ -420,7 +422,7 @@ def with_indent_type(self, indent_type: str = '\t'):
420422
self.indent_type = original_indent_type
421423

422424

423-
class DelimitedList(List[str]):
425+
class DelimitedList(List[_S]):
424426
"""
425427
Subclass of :class:`list` that supports custom delimiters in format strings.
426428

0 commit comments

Comments
 (0)