mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Update the code to better reflect recommended style:
Use != instead of <> since <> is documented as "obsolescent". Use "is" and "is not" when comparing with None or type objects.
This commit is contained in:
parent
c140131995
commit
8152d32375
36 changed files with 101 additions and 99 deletions
|
@ -108,7 +108,7 @@ def commonprefix(m):
|
|||
prefix = m[0]
|
||||
for item in m:
|
||||
for i in range(len(prefix)):
|
||||
if prefix[:i+1] <> item[:i+1]:
|
||||
if prefix[:i+1] != item[:i+1]:
|
||||
prefix = prefix[:i]
|
||||
if i == 0: return ''
|
||||
break
|
||||
|
@ -210,7 +210,7 @@ def expanduser(path):
|
|||
(A function should also be defined to do full *sh-style environment
|
||||
variable expansion.)"""
|
||||
|
||||
if path[:1] <> '~':
|
||||
if path[:1] != '~':
|
||||
return path
|
||||
i, n = 1, len(path)
|
||||
while i < n and path[i] not in '/\\':
|
||||
|
@ -303,7 +303,7 @@ def normpath(path):
|
|||
comps[i-1] not in ('', '..'):
|
||||
del comps[i-1:i+1]
|
||||
i = i - 1
|
||||
elif comps[i] == '' and i > 0 and comps[i-1] <> '':
|
||||
elif comps[i] == '' and i > 0 and comps[i-1] != '':
|
||||
del comps[i]
|
||||
elif '.' in comps[i]:
|
||||
comp = comps[i].split('.')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue