in reply to a glob w/ no wildcards returns itself
While you can certainly argue for (or against) any of the different globbing behaviors - ranging from "the shell"'s (interpret wildcards literally, if no match in the file system) to Python's (always test for existence) - ultimately, it's a matter of preference.
Personally, I find Perl's mixed behavior rather "do-what-I-mean". I.e., when I specify a ? or * wildcard, I'm typically interested in what matching files there are in the file system, while if I use a "limited set" wildcard like {a,b,c}, I can compactly compute permutations with it, e.g.
$ perl -le 'print for glob "{foo,bar}{baz,quux}"' foobaz fooquux barbaz barquux
which Python doesn't do because of its consistent behavior. IOW, consistent isn't always the most practically useful... :)
And, as for the shell, I always found its behavior to treat a "*" literally (in case nothing matches) a little counter-intuitive... (if I really mean a literal "*", I can always escape it in Perl).
Anyhow, YMMV.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: a glob w/ no wildcards returns itself
by jeberle (Initiate) on Aug 23, 2011 at 19:32 UTC |