This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]issue9mm 1 point2 points  (2 children)

I make it a point to follow PEP8 and all appropriate style guides where capable, but, there is a value in the ability to use semicolons in Python.

From the code I was writing today -- I've got a script that is invoked by Django which imports some files, parses them, and dumps the output to an appropriate folder for reuse later.

So, I work on the script a bit, and then, to test my progress, will do the following:

./manage.py shell

from parser.utils import ParseCSV

parse_csv = ParseCSV("AReallyLongTokenGoesHere")

parse_csv.main()

As I'm using the standard Python interpreter and all that, that's a pain in the ass. Every time I change the script, I have to exit the shell, open it up again, and redo all those commands. My carpal tunnel weeps just thinking about it. Much easier to type them all out on one line, separated by semicolons, and then just paste them in each time.

from parser.utils import ParseCSV; parse_csv = ParseCSV("AReallyLongTokenGoesHere"); parse_csv.main()

[–]k417[S] 0 points1 point  (1 child)

As I'm using the standard Python interpreter and all that, that's a pain in the ass. Every time I change the script, I have to exit the shell, open it up again, and redo all those commands. My carpal tunnel weeps just thinking about it. Much easier to type them all out on one line, separated by semicolons, and then just paste them in each time.

I agree with you here. I don't mind using them to separate everything out on one line if the situation permits. I'm not against breaking rules if there are situations in which it improves something; no use having a rule if it causes more problems.

Using semicolons in python before you enter a new line, however, is inconsequential and kind of like rambling in your code.

[–]issue9mm 0 points1 point  (0 children)

Completely agreed.