[New-bugs-announce] [issue6764] os.path.join should call os.path.normpath on result

Michael Foord report at bugs.python.org
Sat Aug 22 23:58:20 CEST 2009

New submission from Michael Foord <michael at voidspace.org.uk>:

os.path.join has very basic behavior in the handling of '..'

>>> import os
>>> os.path.join('/foo', '..')

For some usecases (comparing paths for example) this is not useful and
you have to manually call normpath on the results:

>>> os.path.normpath(os.path.join('/foo', '..'))

Because of this code gets littered with annoyingly long chained calls
which are a pain to both read and write.

Is there any problem with join always calling normpath on it's result?

components: Library (Lib)
keywords: easy
messages: 91877
nosy: michael.foord
severity: normal
status: open
title: os.path.join should call os.path.normpath on result
type: behavior
versions: Python 2.7, Python 3.2

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list