[issue18087] os.listdir don't show hidden option

2013-05-29 Thread Dražen Lučanin
Dražen Lučanin added the comment: @Amaury Forgeot d'Arc - well, the '.' and '..' special files are detected directly in the listdir code, so I don't think there is any need to interleave this logic any deeper (such as os.path.ishidden). @Antoine Pitrou - a one-liner, but it unnecessarily complic

[issue18087] os.listdir don't show hidden option

2013-05-29 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- resolution: -> rejected stage: -> committed/rejected status: open -> closed ___ Python tracker ___

[issue18087] os.listdir don't show hidden option

2013-05-29 Thread Dmi Baranov
Dmi Baranov added the comment: > Also, as mentioned, what you want to hide is not necessarily > well-defined. For example, under Unix you might want > to hide "*~" files. Yes, and instead of adding another parameters, something like that: os.listdir(path, show_hidden=False, hidden_files_mask='*

[issue18087] os.listdir don't show hidden option

2013-05-29 Thread Antoine Pitrou
Antoine Pitrou added the comment: I don't really understand, since this is an easy one-liner: [n for n in os.listdir(...) if not n.startswith(".")] Also, as mentioned, what you want to hide is not necessarily well-defined. For example, under Unix you might want to hide "*~" files. So I don't t

[issue18087] os.listdir don't show hidden option

2013-05-29 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: The concept of hidden file depends on the platform, and is independent of the listdir() function. The first thing is to agree on an implementation of the "hidden" property, and expose it as os.path.ishidden. Then we can consider an option to os.listdir.

[issue18087] os.listdir don't show hidden option

2013-05-29 Thread Dražen Lučanin
Dražen Lučanin added the comment: I created a first version of the patch (attached as a remote hg repo). It would enable users to exclude hidden files with: import os print(os.listdir(path='.', show_hidden=False)) while still keeping full backwards compatibility, since show_hidden is a

[issue18087] os.listdir don't show hidden option

2013-05-28 Thread Dmi Baranov
Dmi Baranov added the comment: So, I'm having a .gitignore file on Windows. Its hidden or not? In other words, only your code feel the difference in "hidden files policy". BTW, Mas OSX using two ways - dotfiles and "invisible" flags in Finder: $ chflags hidden i-am-hidden-now.txt (but 'ls' sho

[issue18087] os.listdir don't show hidden option

2013-05-28 Thread Dražen Lučanin
New submission from Dražen Lučanin: I would like to be able to list a directory, but without showing hidden files. Currently, as discussed in a SO question [1], one has to either code this manually or resort to other libraries (glob). This functionality should be available in the os module. [