#π how do i fix my AWFUL code presentation
46 messages Β· Page 1 of 1 (latest)
@foggy crag
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
You could package things like coordinates into tuples
like when you create a physics object, you could pass in (x, y) for the x and y position
but honestly I don't think it looks bad
I think the name is worse than the initializer body.
ill work on it i guess
good idea
or should i do lists
cuz i cant really edit tuples
doesn't really matter as you can unpack the arguments
oh
oh yeah i can
but its probably easier to directly edit the list than create new variables to unpack the tuple into
and update the tuple
what I am saying is this
you have xpos and ypos as parameters
instead you can just have pos_tuple
ohh
then you do self.xpos = pos_tuple[0]
i get it
not sure if thats considered better or not
i mean
if you think it will be more common for you to set the density then the gravity i would suggest to have the two switch order in the signature of the __init__ function
do you know how to use type hints?
i think that could be helpful here
yeah, especially for the signature of the functions
with that many parameters you probably will need to reformat it anyways
ruff is a great tool to both check your code for potential problems and areas of improvement as well as let it format the code for you in a standard way
idk what it is
ill check it out tomorrow
now i should probably get to sleep
im absolutely washed
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.