For me, this makes the code more readable and thus a good convention.
I think that the key difference in terms of style between variable assignments and function keyword assignments is that for the former there should be only one = in a string, while in the general case for the latter, several = .
If there were no other considerations, we would prefer foo = 42 to foo=42 , since the latter is not the same as the equal sign, as a rule, is formatted, and because the former clearly visually separates the variable and value with spaces.
But when there are several assignments in one line, we prefer f(foo=42, bar=43, baz=44) f(foo = 42, bar = 43, baz = 44) , since the former visually separates several assignments. with spaces, while the latter doesn't, making it a little harder to see where the keyword / value pairs are.
Here is another way to express this: there is consistency behind the agreement. This sequence is as follows: the "highest level of separation" is visually clarified through spaces. There are no lower levels of separation (because it will be confused with spaces separating the higher level). To assign a variable, the highest level of separation is between the variable and the value. To assign function keywords, the highest level of separation is between the individual assignments themselves.
Denziloe Jul 03 '19 at 21:48 2019-07-03 21:48
source share