Код: Выделить всё
class MyPath(Path):
def __init__(self, str_path):
str_path = str_path.upper() # just representative, not what I'm actually doing
super().__init__(str_path)
Код: Выделить всё
foo = MyPath("/path/to/my/file.txt")
bar = foo / "bar"
Я использую Python 3.12, который, насколько я понимаю, обеспечивает лучшую поддержку создания подклассов Path
Подробнее здесь: https://stackoverflow.com/questions/790 ... t-operator