this post was submitted on 25 Apr 2025
24 points (90.0% liked)

Python

7049 readers
46 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

πŸ“… Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

🐍 Python project:
πŸ’“ Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 2 years ago
MODERATORS
24
How is my Python code? (raw.githubusercontent.com)
submitted 1 day ago* (last edited 1 day ago) by [email protected] to c/python
 

I don't know if it's the true place to ask, apologizing if not. I started to python one and half week ago. So I'm still beginner.

I made a terminal based weather application with python. What do you think about the code, is it good enough? I mean is it professional enough and how can I make the same functions with more less code?

Here's the main file (I also added it as url to post): https://raw.githubusercontent.com/TheCitizenOne/openweather/refs/heads/main/openweather.py
Here's the config.json file: https://raw.githubusercontent.com/TheCitizenOne/openweather/refs/heads/main/config.json

you are viewing a single comment's thread
view the rest of the comments
[–] KindaABigDyl 11 points 1 day ago (8 children)

You appear to be afraid of spaces. Everything is cramped together.

Just bc you don't have to put a space after colons or after equals and commas and whatnot doesn't mean you shouldn't

Don't be afraid of spaces.

They make it easier for you to read your code when you come back later

[–] [email protected] 3 points 1 day ago (5 children)

Oops, sorry. I will revise the code and place spaces. Thanks for suggestion <3

[–] [email protected] 6 points 1 day ago* (last edited 1 day ago) (2 children)

Usually, you would use a formatter anyway - it's good to know the standard way but for day to day coding I just have a shortcut bound that runs ruff format (you can even have it done automatically on file save).

[–] [email protected] 1 points 1 day ago (1 children)

I need to search formatters. Thank you for suggestion.

load more comments (2 replies)
load more comments (4 replies)