[New-bugs-announce] [issue44509] Build in type alias for paths
alex rakowski
report at bugs.python.org
Fri Jun 25 16:11:24 EDT 2021
New submission from alex rakowski <alexrakowski90 at gmail.com>:
Hello,
I've noticed that when type hinting paths, it often becomes a bit verbose:
from typing import Union
import pathlib
custom_path = Union[str, pathlib.Path]
def foobar(x:custom_path):
...
Writing functions which handle paths are pretty routine, I'm wondering if it is worth including something that is importable e.g.
from typing import PathLike #or similar path_obj, PathType etc.
def foobar(x:PathLike):
...
Apologies if similar functionality already exists,
Alex
----------
components: Library (Lib)
messages: 396526
nosy: arakowski
priority: normal
severity: normal
status: open
title: Build in type alias for paths
type: enhancement
versions: Python 3.10, Python 3.11
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44509>
_______________________________________
More information about the New-bugs-announce
mailing list