New submission from alex rakowski :
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
<https://bugs.python.org/issue44509>
___
___
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com