[Python-ideas] Improving fn(arg=arg, name=name, wibble=wibble) code
boxed at killingar.net
Thu Sep 13 14:35:02 EDT 2018
> Using keyword arguments is not painful. It's ugly in some unusual cases, such as creating helper functions with nearly the same signature.
It’s more painful than positional. To me the fact that everyone who works on code bases that are of non-trivial size see positional arguments being used for calls with more than 3 arguments is a pretty obvious proof. I know I write them myself because it’s nicer even though you’ll have a hard time finding someone who is more of a proponent for kwargs everywhere than me!
I feel this pain daily. You aren’t me so you can’t say if I feel this or not.
> I try to avoid that situation in my own code. It sometimes requires a significant design change, but I'm usually pleased with the results. If you don't have the inclination to reconsider the design, it could be nice to create a standard code pattern for these pass-through functions to make them more beautiful.
Not talking about those. But I agree that fixing those might be a good first step. Unless it hinders the progress of the bigger issue of course.
I’ll repeat myself: what about .format()? If you localize you can’t use f-strings. What about templates in web apps? Obviously f-strings won’t do. What about json blobs in REST APIs? Again no help from f-strings. What about functions with more than 3 arguments generally?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas