mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 19:52:54 +01:00
Added a return value to shrinkList, the number of things removed from the list.
This commit is contained in:
parent
320f1d26b7
commit
f0b533098c
@ -293,8 +293,11 @@ def privmsgPayload(L, sep, limit=425):
|
|||||||
def shrinkList(L, sep='', limit=425):
|
def shrinkList(L, sep='', limit=425):
|
||||||
"""Shrinks a list of strings to a given combined length of limit."""
|
"""Shrinks a list of strings to a given combined length of limit."""
|
||||||
length = len(sep)
|
length = len(sep)
|
||||||
|
count = 0
|
||||||
while reduce(operator.add, map(length.__add__, map(len, L)), 0)> limit:
|
while reduce(operator.add, map(length.__add__, map(len, L)), 0)> limit:
|
||||||
L.pop()
|
L.pop()
|
||||||
|
count += 1
|
||||||
|
return count
|
||||||
|
|
||||||
|
|
||||||
class IrcString(str):
|
class IrcString(str):
|
||||||
|
Loading…
Reference in New Issue
Block a user