
Am 03.05.2013 03:56, schrieb MRAB:
It wouldn't be """s.file_type=='file'""", but """'file' in s.file_type""".
And I agree about 'reg'.
But calling it 'file' is confusing to everyone who _does_ know stat. Anything you can call stat on is a file.
...even if os.path.isfile(...) says it isn't.
And I don't know of a good answer here.
Maybe "file_type" is the wrong name for it.
It's the POSIX nomenclature and the Plan 9 concept "everything is a file". POSIX calls it "file type" all over the place, e.g. in the documentation of stat's st_mode field. A new term is going to confuse lots of Unix developers. Windows developer are only used to two kinds of files: regular files and directories. Even symlinks are rarely used on Windows. I agree that Windows developers are going to be confused by the concept of 'reg' or 'regular file'. Andrew's sugestion of an enum instead of strings has a nice benefit. We can have both concepts if file_types.FILE == file_types.REG. Christian