>>> from pathlib import Path
>>> p = Path('/etc/swift/object.ring.gz')
>>> p.suffix
'.gz'
>>> p.suffixes
['.ring', '.gz']
>>> p.stem
'object.ring'
>>> p.stems
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'PosixPath' object has no attribute 'stems'
I think it would have been nice if .stems = ['object', '.ring']
The idiomatic answer for this persons definition of "true" stem:
https://stackoverflow.com/questions/31890341/clean-way-to-get-the-true-stem-of-a-path-object
... seemed to [ab]use with_suffix(‘’), but .stems[0] might be more obvious.
What do you think?
--
Clay Gerrard
--
Clay Gerrard
210 788 9431
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/JATPO7Y4KIOJ76ZN5HOV3CP7QLKXOXIE/
Code of Conduct: http://python.org/psf/codeofconduct/