You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The benefit of using pathlib.Path is user-friendly interface for OS-independent path manipulations because you can use "/" operator to concatenate paths instead of using separate os.path.join() function calls (see templates_dir below).
Pathlib paths are also supported in Python standard library modules and functions (open() and other similar cases), so using pathlib.Path objects (instead of strings) is transparent for the user in the usual cases where file paths are used in Python.
Example chamtest.py (with testtemplate.pt in templates directory):
Yeah and to be extra clear for other readers, I'm suggesting accepting both str and pathlib.Path (in type hint something like Union[str, pathlib.Path]).
@markkuleinio note that search_path must be an iterable, e.g. search_path=[my_path1, my_path2].
Ideally there would be some type-checking, but this is old-school Python and we haven't gotten around to adding any typings and there's not a lot of arguments checking either.
Pathlib
(https://docs.python.org/3/library/pathlib.html) was introduced in Python 3.4, I'm suggesting adding support for it when handling file paths inchameleon
.The benefit of using
pathlib.Path
is user-friendly interface for OS-independent path manipulations because you can use "/" operator to concatenate paths instead of using separateos.path.join()
function calls (seetemplates_dir
below).Pathlib
paths are also supported in Python standard library modules and functions (open()
and other similar cases), so usingpathlib.Path
objects (instead of strings) is transparent for the user in the usual cases where file paths are used in Python.Example
chamtest.py
(withtesttemplate.pt
intemplates
directory):Results:
The text was updated successfully, but these errors were encountered: