I have this use case:
new_dir = os.path.join( var_a, var_b, var_c )
where each var evaluates to string and so, the first var is not a path object.
to use path.py i need to do this:
new_dir = path('').joinpath( var_a, var_b, var_c )
new_dir = path.joinpath( path(var_a), var_b, var_c )
new_dir = path( var_a ).joinpath( var_b, var_c )
and i have lists too, which is a pain:
path.joinpath(path(p) for p in List) ?
path.joinpath(map(path, List)) ?
sum(map(path, List)) ?!
path(path.os.sep.join(List)) ?! :(
what do you think about pass lists to the constructor? or maybe joinpath to be a staticmethod?
new_dir = path(os.path.join(var1, var2, var3))
joinpath as a static method seems like a reasonable idea. It's certainly worth exploring.
I often use:
new_dir = path(var_a) / var_b / var_c
But I don't like it because the syntax is incongruent (var_a is treated differently than var_b, but they fundamentally represent the same concept.
Now joinpath may be invoked as a classmethod or as an instance method…
…. This allows construction of a path object from a list of strings. Fixes #12