[Python-ideas] Short form for keyword arguments and dicts

Joao S. O. Bueno jsbueno at python.org.br
Wed Jun 26 17:43:53 CEST 2013


On 24 June 2013 19:41, Steven D'Aprano <steve at pearwood.info> wrote:
> On 25/06/13 03:58, Andrew McNabb wrote:
>>
>> I'm not even sure I like it, but many of the responses have denied the
>> existence of the use case rather than criticizing the solution.
>
>
> I haven't seen anyone deny that it is possible to write code like
>
> spam(ham=ham, eggs=eggs, toast=toast)
>
> What I've seen is people deny that it happens *often enough* to deserve
> dedicated syntax to "fix" it. (I use scare quotes here because I don't
> actually think that repeating the name that way is a problem that needs
> fixing.)
>

Sorry for being silent for agreeing with the original proposal - but indeed -
I think it does happen often enough to ask for some change - doubly so
with stgin/template formatting calls (It is not fun to have to
maintain 3rd party code
doing format(**locals() ) , and just writting every used constant
twice - and _then_ having to justify to others why that, awfull as it
looks, is way better than using the **locals() call. (and yes, it
_does_ happen)
, I think that there could possibly be something better than the
proposed  syntax  -and we culd get to it - but as it is, it would eb
good enough for me.


  js
 -><-


More information about the Python-ideas mailing list