This doesn't work:
something = \
line_of_code * \ # Comment
another_line_of_code * \ # Comment
and_another_one * \ # Comment
etc
Neither does this:
something = \
# Comment \
line_of_code * \
# Comment \
another_line_of_code * ...
Neither does this:
something = \
''' Comment ''' \
line_of_code * \
''' Comment ''' \
another_line_of_code * ...
If there a way to make comments in the code broken into multiple lines?
Not sure what you are trying to do is supported by python. Read PEP8 section about inline comments. Putting comments in the middle of line continuations is "ugly" and probably confusing.
Python way is with
#
on every line if you want to comments something or for inline comments everything after#
is ignored.If you really want to comment a multiline statement that is really necessary put it before or after it.
definately don't want to get into an argument about style, but just because you can do something doesn't mean that it is clear. Inline comments are great for clarifyling short lines of code that just need a short pointer.
Do it like that:
Actually, according to PEP8 parentheses are preferred over slashes, when breaking something into multiple lines:
In your case it also allows to put comments.
Here is a proof, that it works: http://ideone.com/FlccUJ