On Sun, 2022-05-08 at 17:36 +0000, tankimarsh...@gmail.com wrote: > An `importlib.resources.as_file` equivalent but for whole directories. > > To access a directory of files in a package and load them (for example, a > skybox with 6 faces), one would need to use `as_file` 6 times with 6 context > managers. Moreover, if the API required a path to a folder that contained the > 6 images, this would require manual extraction. > _______________________________________________ > 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/XQVE3FY5RYL5Y6X6MOOG7TIMIN3AQ4SB/ > Code of Conduct: http://python.org/psf/codeofconduct/
Hi, Can you provide examples of use-cases that would require something like that? files() returns a Traversable, which is a subset of pathlib.Path (in practice, if the module exists on the filesystem it would actually be a pathlib.Path instance), which you can use to access the data. as_file() exists because needing a file on the file system is sort of common, but from my experience the same is not true for directories. While I can see the value in what you propose, I worry it is not a common enough use-case. Some code examples would definitely help out here. Cheers, Filipe Laíns
signature.asc
Description: This is a digitally signed message part
_______________________________________________ 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/Z4HRCUNKYISGOHT6BWBM7EW7H573OMQ2/ Code of Conduct: http://python.org/psf/codeofconduct/