Bad docs for os.path.isabs()

B

Ben Allfree

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).
 
B

Bengt Richter

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).

While you're at it, better take this into account also ;-)
True

For that last one, I think you could argue that it's false, since it does not
absolutely specify what the meaning is in a multi-drive system.

The whole drive letter file path thing is soo lame it makes me incoherent ;-/

Regards,
Bengt Richter
 
P

Peter Hansen

Ben said:
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".
(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
 
G

Georgy Pruss

Peter Hansen said:
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".
'C:\\bar'

And both are right
G-:
 
G

Georgy Pruss

Return True if path is an absolute pathname i.e. it begins with a slash or backslash,
possibly prepended by a drive letter and a colon.

.... or something like that.

Sorry for my bad English.
G-:
 
F

Francis Avila

Georgy Pruss said:
'C:\\bar'

And both are right
G-:

Ugh.

"Return True if path is not relative to the current working directory."

Better:

"Return True if path is not a relative pathname."
 
J

Jeremy Fincher

Ben Allfree said:
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).

Since no one's mentioned it yet, this is something you should file as
a bug on SF.net.

Jeremy
 
F

Frank Bechmann

IIRC (I currently have no DOS console at hand) even this is wrong:

"Return True if path is not relative to the current working
directory."

because the case "D:xyz" means a path relative to current path on
drive D: which is eventually not the same as the current working
directory.
 
P

Peter Hansen

Frank said:
IIRC (I currently have no DOS console at hand) even this is wrong:

"Return True if path is not relative to the current working
directory."

because the case "D:xyz" means a path relative to current path on
drive D: which is eventually not the same as the current working
directory.

You are correct, although the best thing for the world might be
if we all just pretended you weren't. :)

-Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top