Bad docs for os.path.isabs()

Georgy Pruss SEE_AT_THE_END at hotmail.com
Sun Nov 9 21:58:27 EST 2003


"Peter Hansen" <peter at engcorp.com> wrote in message news:3FAEB530.D67D27BC at engcorp.com...
> Ben Allfree wrote:
> >
> > The docs for os.path.isabs() state:
> >
> >       isabs( path)
> >
> > Return True if path is an absolute pathname (begins with a slash).
> >
> > This is false becase os.path.isabs("C:\\foo") == True
> >
> > It should read:
> >
> >       isabs( path)
> >
> > Return True if path is an absolute pathname (begins with a slash or drive
> > letter).
>
> As Bengt says, that revision is still insufficient/incorrect.
>
> Probably the only way it can really be said is something like
> "returns True if os.path.abspath() would leave the path unchanged".


>>> os.path.isabs("C:\\foo\\..\\bar")
True
>>> os.path.abspath("C:\\foo\\..\\bar")
'C:\\bar'

And both are right
G-:

> (Or some variation on that... i.e. leave the actual specification
> to the nuts-and-bolts of the platform-dependent code, rather than
> trying to rewrite it in English and risk duplication/errors.)
>
> -Peter






More information about the Python-list mailing list