Ask coding questions

← Back to all posts
How can I sort better?
SaladHat (1)

This seems like a stupid question but, I'm slowly getting better at coding and have been wanting to add more things, such as more commands. Unfortunately, I've found myself getting lost in the code. I'm fairly confident there's a way to avoid this, but I'm not sure how. Any suggestions?

Comments
hotnewtop
FishballNooodle (213)

Don't take me down on this PEP 8 but you can import modules more cleanly.
For example instead of doing

import json
import ast

you can do this
import json,ast

Also if you want your code to be cleaner you can add a separate .py file for every command by using something called cogs.
So you immediately know where to go if you want to change something.
You can find some examples in the wrapper itself

InvisibleOne (3226)

What do you mean? Lost in the code?