why brackets & commas in func calls can't be ommited? (maybe it could be PEP?)
Bart Willems
b.r.willems at gmail.com
Thu Mar 22 12:57:36 EDT 2007
dmitrey wrote:
> 1st still is shorter by 1 char; considering majority of people use
> space after comma & number of parameters can be big it yileds
> foo bar baz bar2 bar3 bar4
> vs
> foo(bar, baz, bar2, bar3, bar4)
I think most readers already agree on the ambiguities part. Now, for the
length of the code...
I agree that in you example the first syntax yields a full /five/ spaces
less than the second syntax. However, it ignores the fact that if you
are creating functions with that many arguments, you are probably doing
something wrong. Can't those arguments be provided as a list?
Let's see what is shorter:
foo bar baz bar2 bar3 bar4
or
foo *bars
Not to mention that it might (or might not) be a good idea to wrap the
function in some kind of class where you can specify a whole bunch of
attributes, so that you do not have to call a function with that many
arguments to start with.
Regards,
Bart
More information about the Python-list
mailing list