Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1a76ef2

Browse files
committed
Added definition for pardir ('..')
1 parent c96207a commit 1a76ef2

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

Lib/os.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,32 @@
22

33
# This exports:
44
# - all functions from either posix or mac, e.g., os.unlink, os.stat, etc.
5-
# - os.path is either module path or macpath
5+
# - os.path is either module posixpath or macpath
66
# - os.name is either 'posix' or 'mac'
77
# - os.curdir is a string representing the current directory ('.' or ':')
8+
# - os.pardir is a string representing the parent directory ('..' or '::')
89

910
# Programs that import and use 'os' stand a better chance of being
1011
# portable between different platforms. Of course, they must then
1112
# only use functions that are defined by all platforms (e.g., unlink
1213
# and opendir), and leave all pathname manipulation to os.path
1314
# (e.g., split and join).
1415

16+
# XXX This will need to distinguish between real posix and MS-DOS emulation
17+
1518
try:
1619
from posix import *
1720
name = 'posix'
1821
curdir = '.'
19-
import path
22+
pardir = '..'
23+
import posixpath
24+
path = posixpath
25+
del posixpath
2026
except ImportError:
2127
from mac import *
2228
name = 'mac'
2329
curdir = ':'
30+
pardir = '::'
2431
import macpath
2532
path = macpath
2633
del macpath

0 commit comments

Comments
 (0)