V
-1
c/coding-for-beginnersjake747jake7471d agoProlific Poster

Just realized I was writing Python functions wrong for months

Started learning Python back in February to help automate some route planning stuff for work. Been watching tutorials and following along, writing functions that take like 6 or 7 parameters. Last week I tried to reuse one of my older scripts for a new route and spent 3 hours debugging because I forgot which parameter went where. A guy on Reddit pointed out I should use default arguments or *args and **kwargs. Fixed it in 10 minutes. Has anyone else had that moment where you realize you've been making things 10x harder than they need to be?
3 comments

Log in to join the discussion

Log In
3 Comments
miasanchez
miasanchez1d agoMost Upvoted
Man I spent a whole week passing seven arguments to every function like it was normal.
7
linda_reed
Read a blog that called that "argument tornado" programming.
2
blair_chen81
Yeah @miasanchez totally called it, argument tornado hits different when you're in it.
10