Syntactic sugar and unpacking of dictionaries

Thanks Chris, so still around 10% in the stdlib by that metric. I definitely have a higher percentage than that in my own code, above 50% if the project I’m looking at right now is representative.

For the syntax, while I do quite like func(keyword=), I would also like func(:keyword), which looks a bit “neater” to me without the dangling equal sign. The motivation comes from [1] the related problem of specifying dictionaries. Given that {keyword} creates a set, I think the best we could do is abbreviate {"keyword":keyword} as {:keyword}, since the variable should always go after the colon. This leads to a natural equivalence:

func(keyword=keyword)
func(**{"keyword":keyword})
func(**{:keyword})
func(:keyword)

But I accept that this feels like much more to take in than just an abbreviation for keyword arguments, so it’s probably not worth discussing.


  1. and to make any sense at all would require also tackling ↩︎