[issue44509] Build in type alias for paths

2021-06-25 Thread alex rakowski


alex rakowski  added the comment:

I just noticed this issue was raised and dismissed in  PEP 519 -- Adding a file 
system path protocol.

--
stage:  -> resolved
status: open -> closed

___
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



[issue44509] Build in type alias for paths

2021-06-25 Thread alex rakowski


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