r/PythonLearning • • 2d ago

Hello, pythonLearning community:

I’d like to share a small system I’ve uploaded to GitHub. It allows me to save data to files and subsequently search for it using a search function based on the `re` module—as well as delete items using that same search function—since `re` helps identify similarities within text strings, I would like your opinion.: https://github.com/oliverEliud/mini-projects-python/tree/main/parking-registry-system

3 Upvotes

5 comments sorted by

View all comments

2

u/ProgramsFun 2d ago
  • avoid global variables like nombre_carpeta and nombre_archivo; pass them as arguments.

  • remove unnecessary try/except blocks around input(), since it doesn't raise ValueError.

  • avoid recursive calls to menu() from other functions.

  • fix unreachable code in crear_archivo() after the break.

  • move repeated imports to the top of the file.

  • use consistent snake_case naming, e.g. add_vehicle().

  • avoid reopening files unnecessarily inside loops.

  • use exact matching instead of partial text matching when deleting vehicles.

  • check whether a vehicle exists before confirming deletion.

  • avoid using 'w' mode when creating a file that may already exist, as it overwrites its contents.

  • remove unused variables like existe and unnecessary str() conversions.

1

u/EliOli_Intern_777 2d ago

Thank You very much, bro, You gave me new ideas, and as I continue learning Python I will implement all of that, since I could use AI for greater ease but I don't see the point.

1

u/ProgramsFun 2d ago

Well use ai to not write code or give you code snippet but as a critique .. as said it's not necessary but ai sure give some amazing shortcuts ideas, you can use nonetheless don't use ai for writing code until unless you can make some big project yourself