On Sun, Sep 9, 2018 at 7:37 AM, Anders Hovmöller <bo...@killingar.net> wrote:
I've spent this whole thread thinking: "who in the world is writing code with a lot of spam=spam arguments? If you are transferring that much state in a function call, maybe you should have a class that holds that state? Or pass in a **kwargs dict? Note: I write a lot of methods (mostly __init__) with a lot of keyword parameters -- but they all tend have sensible defaults, and/or will have many values specified by literals. Then this: > It would almost certainly become the strongly preferred way to do it for > some cases like .format() and sending a context to a template renderer in > web apps. But that’s because in those cases it is very important to match > the names. OK -- those are indeed good use cases, but: for .format() -- that's why we now have f-strings -- done. for templates -- are you really passing all that data in from a bunch of variables?? as opposed to, say, a dict? That strikes me as getting code and data confused (which is sometimes hard not to do...) So still looking for a compelling use-case -CHB -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception chris.bar...@noaa.gov
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/