Tuesday, 3 September 2013

How can I create inline comments (without using backslash to continue on another line)?

How can I create inline comments (without using backslash to continue on
another line)?

Sorry in advance if this is something really easy, I'm very new to Python.
This seems like it should be something very simple, but I am having a
frustratingly hard time finding an answer online.
I'm writing a Python script in a preliminary, pseudo sort of fashion at
the moment, and don't have all variable defined yet. I want to be able to
have comments in the middle of a line to symbolize where the variable will
go, but without commenting out the entire rest of the line to the right.
To visualize what I mean, this is how what I want is done in C/C++:
int some_variable = /*some_variable_that_doesnt_exist_yet*/ +
an_existing_variable;
Basically I need to be able to comment the middle of a line without
commenting the left or right sides of said comment. Is there any way to do
this?
I know there's a way to do it like this (or something similar to this):
some_variable = #some_variable_that_doesnt_exist_yet
\+ an_existing_variable
...but I'd rather not do it that way if possible, just for ease of reading.

No comments:

Post a Comment