[issue13968] Add a recursive function to the glob package

2012-02-08 Thread Antoine Pitrou
Antoine Pitrou added the comment: I'm trying the patch and its behaviour is strange: >>> list(glob.rglob('setup.py')) ['setup.py'] >>> list(glob.rglob('setu*.py')) [] >>> list(glob.rglob('*/setu*.py')) ['./setup.py', './Mac/Tools/Doc/setup.py', './Tools/test2to3/setup.py', './Doc/includes/setu

[issue13968] Add a recursive function to the glob package

2012-02-08 Thread Eli Bendersky
Eli Bendersky added the comment: >> Google "walk directory". First hit is a Rosetta code page with >> *recursive* walking implemented in various languages. So I guess it >> does have this connotation. Regardless, os.walk has been in Python for >> ages, and it's always been the go-to tool for rec

[issue13968] Add a recursive function to the glob package

2012-02-08 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Google "walk directory". First hit is a Rosetta code page with > *recursive* walking implemented in various languages. So I guess it > does have this connotation. Regardless, os.walk has been in Python for > ages, and it's always been the go-to tool for recurs

[issue13968] Add a recursive function to the glob package

2012-02-08 Thread Éric Araujo
Éric Araujo added the comment: Feedback from Antoine on IRC about my syntax proposal: “The "**" meaning is not really universal like other quantifiers are. [...] (also, it would be quite harder to implement, I think)” That and the compat issue makes me go in favor of a new function. I’m not

[issue13968] Add a recursive function to the glob package

2012-02-08 Thread Eli Bendersky
Eli Bendersky added the comment: >> IOW, globbing is usually understood as the act of expanding a pattern >> to the files it matches. Nothing in that implies recursive traversal >> of a directory tree. > > Still, that's a common need. "I want all Python files in a subtree". > >> On the other han

[issue13968] Add a recursive function to the glob package

2012-02-08 Thread Antoine Pitrou
Antoine Pitrou added the comment: > IOW, globbing is usually understood as the act of expanding a pattern > to the files it matches. Nothing in that implies recursive traversal > of a directory tree. Still, that's a common need. "I want all Python files in a subtree". > On the other hand, os.w

[issue13968] Add a recursive function to the glob package

2012-02-08 Thread Eli Bendersky
Eli Bendersky added the comment: >> It is. globbing is a well-known operation that many people expect to be >> easily done. According to Wikipedia (http://en.wikipedia.org/wiki/Glob_%28programming%29) - "The noun "glob" is used to refer to a particular pattern, e.g. "use the glob *.log to ma

[issue13968] Add a recursive function to the glob package

2012-02-08 Thread Éric Araujo
Éric Araujo added the comment: There is an alternative: supporting ** syntax, e.g. '**/*.py', which should find all *.py files in the current directory and all descendents. At present glob('**/*.py') is equivalent to glob('*/*.py'), but we would say this behavior was undefined and the new be

[issue13968] Add a recursive function to the glob package

2012-02-08 Thread Antoine Pitrou
Antoine Pitrou added the comment: > "file_paths(filtered_walk('.', included_files=['*.py']))" is a lot > longer than "rglob('*.py')". > > > It is, but is that a good enough reason to have both? It is. globbing is a well-known operation that many people expect to be easily done. > However, th

[issue13968] Add a recursive function to the glob package

2012-02-08 Thread Eli Bendersky
Eli Bendersky added the comment: "file_paths(filtered_walk('.', included_files=['*.py']))" is a lot longer than "rglob('*.py')". It is, but is that a good enough reason to have both? It can also be achieved with just a bit more code using the simple `os.walk`. I suppose there are a lot of i

[issue13968] Add a recursive function to the glob package

2012-02-08 Thread Nick Coghlan
Nick Coghlan added the comment: I can live with it either way - I just wanted to point out that our current examples of this kind of recursive filesystem access use a 'tree' suffix rather than an 'r' prefix. -- ___ Python tracker

[issue13968] Add a recursive function to the glob package

2012-02-08 Thread Antoine Pitrou
Antoine Pitrou added the comment: > To follow the shutil naming convention (rmtree, copytree, and likely > chmodtree, chowntree), a more appropriate name might be "globtree". > (Thanks to string methods, the 'r' prefix doesn't read correctly to > me: what does "globbing from the right" mean?) W

[issue13968] Add a recursive function to the glob package

2012-02-08 Thread Nick Coghlan
Nick Coghlan added the comment: A fair point indeed. To follow the shutil naming convention (rmtree, copytree, and likely chmodtree, chowntree), a more appropriate name might be "globtree". (Thanks to string methods, the 'r' prefix doesn't read correctly to me: what does "globbing from the r

[issue13968] Add a recursive function to the glob package

2012-02-08 Thread Antoine Pitrou
Antoine Pitrou added the comment: > "file_paths(filtered_walk('.', included_files=['*.py']))" is a lot > longer than "rglob('*.py')". Agreed. -- nosy: +pitrou ___ Python tracker __

[issue13968] Add a recursive function to the glob package

2012-02-08 Thread Yuval Greenfield
Yuval Greenfield added the comment: I'd say it's very close to a duplicate but maybe isn't so. If walkdir is added then rglob can be implemented using it. I'd say "rglob" to "walkdir" is like "urlopen" to "http.client". One is the stupid and simple function (that still has a bazillion use cas

[issue13968] Add a recursive function to the glob package

2012-02-08 Thread Nick Coghlan
Nick Coghlan added the comment: I'm inclined to close this as a functional duplicate of http://bugs.python.org/issue13229 -- nosy: +ncoghlan ___ Python tracker ___

[issue13968] Add a recursive function to the glob package

2012-02-08 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' : -- nosy: +giampaolo.rodola ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http:

[issue13968] Add a recursive function to the glob package

2012-02-08 Thread Yuval Greenfield
New submission from Yuval Greenfield : This is a feature I've wanted to use in too many times to remember. I've made a patch with an implementation, docs and a test. I've named the function rglob and tried to stay within the conventions of the glob package. -- components: Library (Lib)