25 May
2020
25 May
'20
9:05 a.m.
Kyle Stanley wrote:
While I'm -1 on the original proposal, I think the idea of PurePath.__len__ returning the number of components in the path may be worth some further consideration.
FYI PEP 428 says: In this proposal, the path classes do not derive from a builtin type. This contrasts with some other Path class proposals which were derived from str. They also do not pretend to implement the sequence protocol: if you want a path to act as a sequence, you have to lookup a dedicated attribute (the parts attribute). So while __len__() is not the whole sequence protocol, it seems like the idea was to explicitely use `len(path.parts)` instead of `len(path)` for this.