I found this list buried in my notes from long ago. I cleaned it up and updated it, but yeah, I still found wisdom in this advice from my former self.
Moreover, this advice is also to myself. I need to be reminded of these guidelines, as I sometimes disregard them and then need to go back and clean up things afterward.
Name functions after what they return.
Name subroutines after what they do.
Name variables after what they hold.
…not after what they’re used for. Put that in a comment, if needed.
Delete old code. Don’t comment it out or leave comments explaining why it isn’t called anymore. The next person who reads the code will not care why the old code isn’t there, only that the new code is there. (Or if he does care, that’s what source-code control is for.)
Don’t use three different names for the same concept or referent. Especially, don’t do this in the same block of code.
Don’t use mixed code conventions. If you have MyFunc and my_func, one of them should be renamed. This is a safe refactoring. (The only exception is where the names are part of a well-used, public API that follows an obsolete convention, such that you can’t fix it without breaking other people’s code. In that case, hold your nose, and I will, too.)
Keep API documentation out of the code comments. Put them in docstrings or POD or JavaDoc or whatever format is appropriate for your programming ecosystem.
That said, keep private documentation out of sight of the public. In some ecosystems, this means putting them in ordinary comments, not in documentation blocks. But still keep these comments out of the code. Put them where the normal documentation would go, usually right above the symbol being documented.
Keep bug reports out of comments. Put them in a bug-tracking database or TODO list. (However, it’s fine to refer to a published bug report to explain why some code was included.)
Comment why the code is there, not what it does. (The exception is when the code implements a specific, esoteric algorithm that is needed in this case, and the reader needs an overview of how it works.)
If it takes you more than a few minutes to figure out that you needed to add a line of code to address a particular issue, consider leaving a comment for the next reader as to why you added it.
Remember that comments must be maintained. If your comment is not actually needed to understand the code, or if it’s too vague to understand, then you’ve made things worse, not better.
Please put capital letters at the beginning of each sentence, and a period at each’s end.
If you change the parameters or values that a function will accept, update its documentation.
Don’t pack multiple behaviors into a single function by specifying different argument values, then unpack them by switching off of the argument value. Instead, use multiple, distinct functions. If you have a formal parameter called action, you probably want multiple functions. If you’re passing in an argument that changes the behavior of the function, then you want two functions. If you have code of the following form, you probably want two functions:
def my_func(value):
if value == SOMETHING:
return x()
else:
return y()
If you have code that reads if type(thing) == 'Spam' or if isinstance(thing, 'Spam'), then consider whether you actually want two different classes and ought to be using polymorphism.
Prefer imports over mixins.
Prefer mixins over inheritance. (Although in some languages, the difference is just in a naming convention.)
Use as few layers of inheritance as you can, but no fewer.
A method that doesn’t use any of an instance’s data probably doesn’t belong in that class. Put the method into the class of the object that it accesses most prominently.
These notes reflect some other long-ago thoughts on the topic.




By Binance创建账户 December 23, 2025 - 12:16 pm
Your point of view caught my eye and was very interesting. Thanks. I have a question for you. https://accounts.binance.com/ph/register-person?ref=IU36GZC4
By Register January 15, 2026 - 2:34 am
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
By binance sign up bonus January 16, 2026 - 2:42 am
Your point of view caught my eye and was very interesting. Thanks. I have a question for you.
By rico777bet February 7, 2026 - 1:06 am
Rico777bet? Yeah, I’ve spun a few rounds there. Pretty smooth experience overall. Definitely worth a look if you’re hunting for something new rico777bet
By okkbetlogin February 7, 2026 - 1:07 am
Hey all, just hopped on okkbetlogin, and the login process was hassle-free. Got into the action quickly. I recommend giving it a try if you’re looking for a smooth experience. Check it out okkbetlogin
By sn88bet February 7, 2026 - 1:07 am
Alright guys, just hopped onto sn88bet and it’s pretty decent. Smooth site, got my bets in quick and easy. Might be my new go-to spot. Check it out at sn88bet!
By бнанс Створити акаунт February 8, 2026 - 7:32 am
Your point of view caught my eye and was very interesting. Thanks. I have a question for you.
By 注册 February 8, 2026 - 9:47 am
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me? https://www.binance.info/ar-BH/register?ref=UT2YTZSU
By best binance referral code February 22, 2026 - 7:06 am
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
By binance тркелгсн жасау February 25, 2026 - 10:26 pm
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me? https://accounts.binance.com/register-person?ref=IXBIAFVY
By create a binance account March 2, 2026 - 4:08 pm
Your article helped me a lot, is there any more related content? Thanks!
By metoclopramide for dogs March 20, 2026 - 6:59 pm
metoclopramide for dogs
metoclopramide for dogs
By binance register March 29, 2026 - 12:42 am
Your point of view caught my eye and was very interesting. Thanks. I have a question for you.
By Код binance March 31, 2026 - 3:18 pm
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
By binance anm"alan April 4, 2026 - 7:20 am
Your point of view caught my eye and was very interesting. Thanks. I have a question for you.
By lasix medicine price April 9, 2026 - 6:52 am
lasix medicine price
lasix medicine price
By arthrotec April 9, 2026 - 5:39 pm
arthrotec
arthrotec
By binance us register April 9, 2026 - 8:01 pm
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me. https://www.binance.info/register?ref=IHJUI7TF
By nitrofurantoin 100mg tablets April 10, 2026 - 6:29 pm
nitrofurantoin 100mg tablets
nitrofurantoin 100mg tablets
By vibramycin for pneumonia April 14, 2026 - 8:52 am
vibramycin for pneumonia
vibramycin for pneumonia
By crazywinph April 15, 2026 - 5:08 am
Dice games are fascinating – the math behind them is surprisingly complex! Seeing platforms like crazywin ph club cater to local preferences with PHP & GCash is smart. Quick verification sounds great too – instant play is key!
By diflucan for yeast infection over the counter April 15, 2026 - 9:16 am
diflucan for yeast infection over the counter
diflucan for yeast infection over the counter
By binance sign up April 16, 2026 - 5:43 pm
Thanks for sharing. I read many of your blog posts, cool, your blog is very good. https://accounts.binance.info/lv/register-person?ref=SMUBFN5I
By viagra creative ads April 21, 2026 - 7:57 am
viagra creative ads
viagra creative ads
By vidalista 20mg buy online April 26, 2026 - 3:37 am
vidalista 20mg buy online
vidalista 20mg buy online
By pancrelipase classification April 29, 2026 - 4:37 pm
pancrelipase classification
pancrelipase classification
By vagiplus April 29, 2026 - 6:32 pm
Really interesting read! The focus on visual experience resonates – I noticed vagiplus download apk emphasizes that too, with their vibrant games & easy sign-up. Quick verification sounds great for peace of mind!
By binance April 30, 2026 - 2:46 pm
Your article helped me a lot, is there any more related content? Thanks!