2
ここでは、Javaで1行の三項式を使った簡単なオブジェクトの作成と割り当てについて説明します。Pythonの三項式
Interval newInterval = previous.end <= current.end ? new Interval(previous.start, current.end : new Interval(previous.start, previous.end)
のpythonと同等であり、
new_interval = Interval(previous.start, current.end) if previous.end <= current.end else Interval(previous.start, previous.end)
私の質問はこれを書くために、よりpythonic
方法は何ですか?
'new_interval =間隔(previous.start、current.end previous.end <=現在の場合.end else previous.end) '私にはもっと合理的だ(両方の言語で)。 –