02.10.21 15:44, Paul Moore пише: > The counter-argument is "there should be one obvious way" - we > definitely don't only have *one* way, at the moment, but none of them > are "obvious". My big problem is that I don't think that making Path > instances iterable is "obvious", either. What if the path is a file, > not a directory? Why are we doing a recursive traversal, not just > doing iterdir?
Ideas of making Path iterable are proposed every several months. The problem is that they are different ideas. One want to iterate path components. Other want to iterate a directory specified by the path (recursively or not). Originally it was rejected because some third-party Path-like implementations can subclass str, and therefore inherit yet different iteration behavior from strings. It is safer to not make Path iterable and provide different methods for iterating different things in different way. _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/BZKCCLG6L3AZJ43KBBYAUSFRCR3Q7J3Q/ Code of Conduct: http://python.org/psf/codeofconduct/