私はするだろう...
word = ("could" if not condition() else "could not")
print "A five ounce bird {0} carry a one pound coconut".format(word)
:P
編集:あなたが望む一般的なケースでは、私は構成で行きます。例えば。(わかりました、これはあまりにも Go4 であり、私の好みには単純すぎますが、要点はわかります):
class Agglutinator(list):
def __str__(self):
return self._separator.join(str(x) for x in self)
class Paragraph(Agglutinator):
"""Returns dot separated sentences"""
_separator = '. '
class Sentence(Agglutinator):
"""Returns comma separated clauses"""
_separator = ', '
class Clause(Agglutinator):
"""Returns space separated words"""
_separator = ' '
c1 = Clause(["A", "number", "of", "words", "make", "a", "clause"])
c2 = Clause(["and", "a", "number", "of", "clauses", "make", "a", "sentence"])
c3 = Clause(["A", "collection", "of", "sentences", "makes", "a", "paragraph"])
s1 = Sentence([c1, c2])
s2 = Sentence([c3])
print Paragraph([s1, s2])
これにより、次のことが得られます。
A number of words make a clause, and a number of clauses make a sentence. A collection of sentences makes a paragraph
少し詳しく説明するとSentence
、最初の単語などを大文字にすることができます。