4 ms·
Have you ever used Python? If you did you really wouldn't be saying this. There isn't an exception. The semicolon is used to put multiple statements on a single
by nightcracker 6y ago
Have you ever used Python? If you did you really wouldn't be saying this. There isn't an exception. The semicolon is used to put multiple statements on a single line. That's it's only use, and that's the only time it's 'needed' - no exceptions.
- lelanthran 6y ago> Have you ever used Python? If you did you really wouldn't be saying this. There isn't an exception. For the ';', perhaps not. For the token that is used to terminate (or separate) statements? Yes, the ';' is an exception to the general rule of how to terminate statements. The semicolon also works on some sort of statements and not others, throwing errors only at runtime. It's easier to remember one rule than many.
- pedrovhb 6y agoHonestly, the rule is "don't use semicolons in Python". I don't think there's a single one in the large codebase I work with, and there's really no reason at all to use it other than maybe playing code golf. It's not a language in which you ever need be saving bytes on the source code. Just use a new line and indent. It's more readable and easier.
- c-cube 6y agoBut python has instead the "insert \ sometimes" rule, which isn't better.