# split a "long" line defined by max_width into a list of lines
line=string.strip(line)
words=string.split(line,' ')
wordnum=0
# iterate over all the words in the line, extending the word list
# necessary for too-long words
aggregate=[]
linelen=0
wordnum=0
whilewords:
word=words.pop(0)
ifnotword:continue
iflen(word)>max_width:
new_words=splitword(word,max_width,linelen)
word=new_words[0]
fornew_wordinnew_words[1:]:
words.insert(wordnum,new_word)
wordnum=wordnum+1
ifwords:
next_word=words[0]
else:
next_word=None
ifnext_wordisNone:
aggregate.append(word)
wordnum=wordnum+1
continue
maybe_len=linelen+len(word)+len(next_word)
ifmaybe_len>=max_width-1:
aggregate.append(word)
aggregate.append(None)
linelen=0
else:
aggregate.append(word)
linelen=linelen+len(word)+1
wordnum=wordnum+1
s=""
last=None
foriteminaggregate:
ifitemisNone:
s='%s\n'%s
eliflastisNone:
s='%s%s'%(s,item)
else:
s='%s %s'%(s,item)
last=item
returnstring.split(s,'\n')
long="""
To turn a component into a product you must fulfill many contracts. For the most part these contracts are not yet defined in terms of interfaces. Instead you must subclass from base classes that implement the contracts. This makes building products confusing, and this is an area that we are actively working on improving. Hereisalonglinethatshouldbecaughtandbrokenupbytheformatter,hopefullyitllgetsplitupwhenirunitthroughthere."""