3 ms·
Is there some kind of slash operator making this statement work? Is this a way to concatenate things? train_path = datasets_root / dataset / 'train'
by Noumenon72 9y ago
Is there some kind of slash operator making this statement work? Is this a way to concatenate things?
train_path = datasets_root / dataset / 'train'
- Cyphase 9y agopathlib[1] has been in the standard library since Python 3.4. It can do this.[2] [1] https://docs.python.org/3/library/pathlib.html https://docs.python.org/3/library/pathlib.html [2] https://docs.python.org/3/library/pathlib.html#basic-use https://docs.python.org/3/library/pathlib.html#basic-use
- necavi 9y agoPython allows the overriding of just about every operator. For Pathlib they overrode the division operator to instead perform path addition in a platform agnostic manner.
- glandium 9y ago> Python allows the overriding of just about every operator. Except the boolean operators (and, or, not). For instance __and__ overrides the binary and (&), not the boolean and.
- Cyphase 9y agoThat's True, but you _can_ override __bool__.[1] [1] https://docs.python.org/3/reference/datamodel.html#object.__bool__ https://docs.python.org/3/reference/datamodel.html#object.__...