Python os module path functions
<p>From the documentation:</p>

<pre><code>os.path.realpath(path)
Return the canonical path of the specified filename, eliminating any 
symbolic links encountered in the path (if they are supported by the 
operating system).
</code></pre>

<p>When I invoke this with an extant file's name, I get the path to it: <code>/home/myhome/myproject</code>.</p>

<p>When I invoke this with a 'nonsense.xxx' string argument, I still get a path to <code>/home/myhome/myproject/nonsense.xxx</code>.  This is a little inconsistent because it looks like <code>nonsense.xxx</code> is taken to be a directory not a file (though it is neither: it does not exist).</p>

<p>When I invoke this with a null string file name, I still get a path to <code>/home/myhome/myproject</code>.</p>

<p>How can I account for this behaviour when the documentation says so little about realpath()?  (I am using Python 2.5.)</p>

<p>Edit: Somebody suggested a way to test if files exist.  My concern is not to test if files exist.  My concern is to account for behaviour.</p>
