Kit Ramos Kit Ramos - 1 year ago 165
Python Question

Python syntax trailing semicolon

So I know in python it's considered bad form to end statements with a ;
when not doing compound statements. and the use of such statements are considered bad form as well. I also understand the reasons to stick with the k.i.s.s. mentality an that since they aren't required it doesn't make sense to keep them. But since at work I spend all my time with programing languages that require it, and only play with python in my spare time, putting semicolons on the end of every statement is a rather ingrained habit. And it's just going to be me looking at my codes anyway so if it's just a style convention I'm not going to worry about it. But if there's an actual reason to avoid it I'd like to know.

So my question is: Does it actually hurt to use them or is it just bad style?
I mean does it cause any performance or other issues or is it just a readability thing?

Why I think this question is different then the one where the guy was asking if they need to put them in, is that I wanted to know if it slowed down the running of the program, or caused it to use more memory or anything other then simply "making it harder for a person to read the code" that wasn't addressed in that topic.

Answer Source

It's purely a style thing. It's not going to hurt performance, and the worst weird edge case you'll run into is that this:

# two of these^

is a syntax error.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download