Jump to content

I'm confused about the commenting part in python

pcnoobie007
3 minutes ago, M.Yurizaki said:

Which is yourself in three months when you forget how your code works. And this is not an uncommon thing in software development.

It's a lot easier for you to understand your code than for others to do so.

That's why it's meant primarily for others, especially when you work in a company where hundreds of people are working on the same program.

NEW PC build: Blank Heaven   minimalist white and black PC     Old S340 build log "White Heaven"        The "LIGHTCANON" flashlight build log        Project AntiRoll (prototype)        Custom speaker project

Spoiler

Ryzen 3950X | AMD Vega Frontier Edition | ASUS X570 Pro WS | Corsair Vengeance LPX 64GB | NZXT H500 | Seasonic Prime Fanless TX-700 | Custom loop | Coolermaster SK630 White | Logitech MX Master 2S | Samsung 980 Pro 1TB + 970 Pro 512GB | Samsung 58" 4k TV | Scarlett 2i4 | 2x AT2020

 

Link to comment
Share on other sites

Link to post
Share on other sites

11 hours ago, Enderman said:

It's a lot easier for you to understand your code than for others to do so.

That's why it's meant primarily for others, especially when you work in a company where hundreds of people are working on the same program.

I understand where you are coming from and more or less agree, that comments are used mostly in industry to communicate between collaborating developers. However, you don't get to say what comments are for, thats up to the commenter to decide.

 

A few examples of other ways comments may be used.

 

If its a closed source personal project then the comments are likely mostly for reminding yourself of how you got something to work.

 

Sometimes comments are used as attribution. e.g. //This function is adapted is from user X at stackoverflow.com/id/123

 

Sometimes comments are used by professors to ensure that students understand what is going on and that they didn't just copy eachother/SO/etc <<< This thread

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×