[Python-ideas] Add OS-dependent automatic glob support

Chris Angelico rosuav at gmail.com
Mon Jan 5 18:14:38 CET 2015


On Tue, Jan 6, 2015 at 4:10 AM, Steven D'Aprano <steve at pearwood.info> wrote:
> * If you want to apply globs to something other than file names,
>   the right module to use would probably be globbing.generic
>   (or possible fnmatch directly).

To clarify: Do you mean "something other than names of
currently-existing files", or "something other than valid names for
the local file system", or something else? For instance, suppose you
write an unarchiver (in case we don't have enough of them already, of
course), and you can "python unarchive.py archivename *.txt" to
extract all files matching *.txt. The globbing would be done against
some sort of internal index, but the names would have to be valid for
the local file system, or you wouldn't be able to create them. Which
module should you use?

ChrisA


More information about the Python-ideas mailing list