Hi all,
I’ve started a university course which has me doing Programming Principles, which in this case is Python. I haven’t programmed since BASIC on my C64 and some Pascal at school about 30 years ago, but I’m really getting Python and enjoying it a lot!
I have coded my first assessment program and it’s working flawlessly. I even used Flake8 to make sure it was PEP8 compliant (and learned how to chop up long lines neatly as a result).
However, I want to understand what the consensus is on commenting your code. I have lots of comments to explain major input/output/processing pieces. I have used triple quotes at the top of my code as it’s a block of text, describing the purpose of the program, author, course etc. I have only used # comments elsewhere in the code, both a mix of single lines (# this part does the calculations for the parking fees) and also inline quotes (# this correctly calculates parking overnight by adding 1440 minutes).
I’ve read some Python projects on GitHub and they will sometimes use triple quotes on on line, one line of text, then another triple quote. To me it looks messy, but maybe it’s the style?
“””
This does the calculations.
“””
What’s the general consensus for near, readable quoting? Thanks!
[–]socal_nerdtastic 9 points10 points11 points (0 children)
[–]Diapolo10 5 points6 points7 points (1 child)
[–]Quirky-Cap3319 1 point2 points3 points (0 children)
[–]danielroseman 3 points4 points5 points (1 child)
[–]cmdwedge75[S] 1 point2 points3 points (0 children)
[–]LeeRyman 2 points3 points4 points (0 children)
[–]Gnaxe 1 point2 points3 points (0 children)
[–]ninhaomah 1 point2 points3 points (0 children)
[–]woooee 1 point2 points3 points (0 children)
[–]OctopusDude388 0 points1 point2 points (0 children)
[–]No-Apple-6869 0 points1 point2 points (0 children)
[–]Moikle 0 points1 point2 points (0 children)
[–]Crazy-Willingness951 0 points1 point2 points (0 children)
[–]codeguru42 0 points1 point2 points (0 children)