mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-07 19:49:23 +01:00
Committing jemfinch's commaAndify fixes
This commit is contained in:
parent
436dc54ac3
commit
ab93b9072f
@ -259,7 +259,8 @@ def findBinaryInPath(s):
|
|||||||
break
|
break
|
||||||
return cmdLine
|
return cmdLine
|
||||||
|
|
||||||
def commaAndify(L):
|
def commaAndify(seq):
|
||||||
|
L = list(seq)
|
||||||
if len(L) == 0:
|
if len(L) == 0:
|
||||||
return ''
|
return ''
|
||||||
elif len(L) == 1:
|
elif len(L) == 1:
|
||||||
@ -267,11 +268,7 @@ def commaAndify(L):
|
|||||||
elif len(L) == 2:
|
elif len(L) == 2:
|
||||||
return '%s and %s' % (L[0], L[1])
|
return '%s and %s' % (L[0], L[1])
|
||||||
else:
|
else:
|
||||||
# Not technically threadsafe. But we'll see if that matters.
|
|
||||||
originalLastElement = L[-1]
|
|
||||||
L[-1] = 'and %s' % L[-1]
|
L[-1] = 'and %s' % L[-1]
|
||||||
s = ', '.join(L)
|
return ', '.join(L)
|
||||||
L[-1] = originalLastElement
|
|
||||||
return s
|
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||||
|
Loading…
Reference in New Issue
Block a user