On 05/15/10 11:56, Lawrence D'Oliveiro wrote: > In message <4bec2a9...@dnews.tpgi.com.au>, Lie Ryan wrote: > >> On 05/13/10 22:41, Lawrence D'Oliveiro wrote: >>> In message <mailman.2720.1273210637.23598.python-l...@python.org>, Chris >>> Rebert wrote: >>> >>>> Also, please don't use semicolons in your code. It's bad style. >>> >>> Wonder why they’re allowed, then. >> >> they're there for line continuation, e.g.: >> >> a = 40; foo(a) >> >> but in many cases, putting two statements in a single line reduces >> readability so use the semicolons extremely conservatively. But the >> worst is the abuse of semicolons for end-of-line markers. > > So why are they allowed, then?
Convenience. I've sometimes, in the interactive interpreter, written codes that looks like: a = 0; ... other code ... since I need to reset the variable 'a' every time 'other code' is run. If there hasn't been the ;, then I'd have to press up, up, enter, up, up, change, enter. Compare that to up, change, enter since I can "up" two "lines" at once. In the interactive interpreter these sort of conveniences is often useful. Unless your "why are they allowed" is about why a blank continuation (i.e. abusing ; as line ending) is allowed. In that case, I'd presume it's just because conceptually: foo(); bar is just: foo() bar() but probably you're right; maybe they should be strictly disallowed. But it's too late for this kind of change, not until py4k. -- http://mail.python.org/mailman/listinfo/python-list