tomerfiliba / plumbum

Plumbum: Shell Combinators
https://plumbum.readthedocs.io
MIT License
2.78k stars 182 forks source link

Override operator `+` for Path and its subclasses #673

Open aleexf opened 6 months ago

aleexf commented 6 months ago

Operator + is not overloaded and comes from the base class str so it returns an instance of type str. This behaviour isn't obvious at all:

>>> type(plumbum.local.path(".") + "/subdir")
<class 'str'>
>>> type(plumbum.local.path(".") / "subdir")
<class 'plumbum.path.local.LocalPath'>