Reducing Function Parameter Number #4290
davidcbhunter
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I recently ran into an issue with the function Page.insert_text. This function has two required parameters, and can take up to 17 total parameters. This seems excessive.
I'd like to propose introducing a number of small classes that would reduce the number of parameters that this and similar functions take. For example, have a TextStyle class that would contain font name, font size, color, and encoding (and potentially other information). If you pass that to the function, that would reduce 4 separate parameters into 1. Similarly, Point and rotation could be combined into a Transform class that contains the positional and rotational information.
Does this seem like a reasonable change? Would it simply enough other functions to be justified?
Beta Was this translation helpful? Give feedback.
All reactions