On 2010-11-07, Lawrence D'Oliveiro <l...@geek-central.gen.new_zealand> wrote: > In message <8jftftfel...@mid.individual.net>, Neil Cerutti wrote: > >> The handsome ':' terminator of if/elif/if statements allows us to >> omit a newline, conserving vertical space. This improves the >> readability of certain constructs. >> >> if x: print(x) >> elif y: print(y) >> else: print() > > I would never do that. ???Conserving vertical space??? seems a > stupid reason for doing it. In C, I even go the opposite way: > > if (x) > { > printf(..., x); > } > else if (y) > { > printf(..., y); > } > else > { > printf(...); > } /*if*/
Interesting. I find conserving vertical space to be a big win. I understand why you'd enforce braces for virtually all code bodies in C. In C, I'm giving up the most obvious form of expression for something obviously more robust. In Python, there's no such trade-off. Forbidding one-line conditional statements in Python would sacrifice succinctness for nothing. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list