Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×
Programming

Journal dthable's Journal: [Python] What's with all the semicolons? 1

I'm looking at the /. journal extraction script written in Python and I keep seeing lots of lines that end in semicolons. Example:


        def getIndexItem(self):
                # create a summary of the entry
                digest = self.body[:self.DIGEST_LEN].replace('\n', '');
                digest = self.HTML_STRIP.sub('', digest);
                digest = digest.replace('>', '').replace('

When I learned about Python and started to work with it, I was told not to use the semicolons. In fact, I thought that was illegal. Is the parser just throwing them away? Does it have any purpose other than making those C programmers happy?

This discussion has been archived. No new comments can be posted.

[Python] What's with all the semicolons?

Comments Filter:
  • ;'s separate multiple statements on a single line.

    In the examples you showed, the second statement is just blank. Since blank statements are always allowed... yah, they pretty much get dropped. :)

    With how little optimization Python does though, I wonder if there is a noticeable performance difference!

If you have a procedure with 10 parameters, you probably missed some.

Working...