On Wed, Apr 11, 2018 at 2:44 PM, Steven D'Aprano
On Wed, Apr 11, 2018 at 02:22:08PM +1000, Chris Angelico wrote:
dict(d1, d2, d3)
That's more readable than {**d1, **d2, **d3} ? Doesn't look materially different to me.
It does to me.
On the one hand, we have a function call (okay, technically a type...) "dict()" that can be googled on, with three arguments; on the other hand, we have syntax that looks like a set {...} and contains the obscure ** prefix operator which is hard to google for.
True, you can google 'dict'. But the double-star operator is exactly the same as is used in kwargs, and actually, I *can* search for it. https://www.google.com.au/search?q=python+** Lots of results for kwargs, which is a good start. (DuckDuckGo is less useful here, though it too is capable of searching for "**". It just gives more results about exponentiation than about packing/unpacking.) The googleability argument may have been a killer a few years ago, but search engines get smarter every day [1], and it's most definitely possible to search for operators. Or at least some of them; Google and DDG don't give me anything useful for "python @". ChrisA [1] and a search engine can help you find SmarterEveryDay, not that he talks about Python