That is a reasonable use, Rob, albeit I would refactor that example in quite a few ways so the need for a semicolon disappears even for lining things up.
So to extrapolate, perhaps a related example might be as simple as wanting to initialialize multiple variables together might suffice as in: if dow == 0: hours_worked = 8; overtime = False Of course some monstrosities are now possible for such a scenario such as if dow == 0: hours_worked, overtime = 8, False Not that readable. I repeat, there is nothing wrong with a language having a feature like a semi-colon even if it is mainly syntactic sugar. Just wondering if it was widely used or even essential. My thought was that python evolved when some languages really needed a terminator but as it went another way, using indentation and sometimes blank lines, ... I am not sure what Dieter meant about seeing semicolons in .pth files. I expect to see them in all kinds of files containing python code or anything created with a structure that chooses to include it. -----Original Message----- From: Python-list <python-list-bounces+avi.e.gross=gmail....@python.org> On Behalf Of Rob Cliffe via Python-list Sent: Wednesday, February 22, 2023 9:11 PM To: python-list@python.org Subject: Re: semi colonic On 23/02/2023 00:58, avi.e.gr...@gmail.com wrote: > So can anyone point to places in Python where a semicolon is part of a > best or even good way to do anything? > > Yes. Take this bit of toy code which I just dreamed up. (Of course it is toy code; don't bother telling me how it could be written better.) If it looks a bit ragged, pretend it is in a fixed font. if dow==0: day="Mon"; calcPay() if dow==1: day="Tue"; calcPay() if dow==2: day="Wed"; calcPay() if dow==3: day="Thu"; calcPay() if dow==4: day="Fri"; calcpay() if dow==5: day="Sat"; calcPay(rate=1.5) if dow==6: day="Sun"; calcPay(rate=2) The point is: when you have several short bits of code with an identical or similar pattern, *vertically aligning* the corresponding parts can IMO make it much easier to read the code and easier to spot errors. Compare this: if dow==0: day="Mon" calcPay() if dow==1: day="Tue" calcPay() if dow==2: day="Wed" calcPay() if dow==3: day="Thu" calcPay() if dow==4: day="Fri" calcpay() if dow==5: day="Sat" calcPay(rate=1.5) if dow==6: day="Sun" calcPay(rate=2) Not so easy to spot the mistake now, is it? Not to mention the saving of vertical space. Best wishes Rob Cliffe PS If you really care, I can send you a more complicated example of real code from one of my programs which is HUGELY more readable when laid out in this way. -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list