[Python-Dev] PEP 355 status

James Y Knight foom at fuhm.net
Thu Oct 26 09:00:57 CEST 2006

On Oct 25, 2006, at 10:48 PM, Talin wrote:
> That's true of textual paths in general - i.e. even on unix, textual
> paths aren't guaranteed to be unique or exist.
> Its been a while since I used classic MacOS - how do you handle things
> like configuration files with path names in them?

You aren't supposed to use paths at all. You're supposed to use an  
Alias whenever you're doing long term storage of a reference to a  
file. This allows the user to move the file around on the disk  
without breaking the reference, which is nice. The alias is an opaque  
datastructure which contains a bunch of redundant information used to  
locate the file. In particular, both pathname and (volumeId, dirId,  
name), as well as some other stuff like file size, etc. to help do  
fuzzy matching if the original file can't be found via the obvious  
locators. And for files on a file server, it also contains  
information on how to reconnect to the server if necessary.

Much of the alias infrastructure carries over into OSX, although the  
strictures against using paths have been somewhat watered down. At  
least in OSX, you don't have the issue of the user renaming the boot  
volume and thus breaking every path someone ill-advisedly stored  
(since volume name was part of the path).

For an example of aliases in OSX, open a file in TextEdit, see that  
it gets into the "recent items" menu. Now, move it somewhere else and  
rename it, and notice that it's still accessible from the menu.  
Seperately, try deleting the file and renaming another to the same  
name. Notice that it also succeeds in referencing this new file.

Hm, how's this related to python? I'm not quite sure. :)


More information about the Python-Dev mailing list