Re: [Python-Dev] Portable and OS-dependent module idea/proposal/brain fart

But in Python, with its nice high-level datastructures, couldn't we design the Mother Of All File Attribute Calls, which would optionally map functionality from one platform to another? As an example consider the Mac resource fork size. If on unix I did fattrs = os.getfileattributes(filename) rfsize = fattrs.get('resourceforksize') it would raise an exception. If, however, I did rfsize = fattrs.get('resourceforksize', compat=1) I would get a "close approximation", 0. Note that you want some sort of a compat parameter, not a default value, as for some attributes (the various atime/mtime/ctimes, permission bits, etc) you'd get a default based on other file attributes that do exist on the current platform. Hmm, the file-attribute-object idea has the added advantage that you can then use setfileattributes(filename, fattrs) to be sure that you've copied all relevant attributes, independent of the platform you're on. Mapping permissions takes a bit more (design-) work, with unix having user/group/other only and Windows having full-fledged ACLs (or nothing at all, depending how you look at it:-), but should also be doable. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm
participants (1)
-
Jack Jansen