Check absolute paths in Python

path, python

Solution

$ touch foo
$ ln -s foo bar
$ python
Python 2.5.1 (r251:54863, Feb  6 2009, 19:02:12) 
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> help(os.path.samefile)
Help on function samefile in module posixpath:

samefile(f1, f2)
    Test whether two pathnames reference the same actual file

>>> os.path.samefile("foo", "bar")
True

Problem

How can I check whether two file paths point to the same file in Python?

Original source