[Python-ideas] Debugging: some problems and possible solutions

Jonathan Fine jfine2358 at gmail.com
Wed Oct 3 14:12:28 EDT 2018

Anders Hovmöller suggested
> Short form of keyword arguments where
> foo(=a, =1+bar)
> Is expanded at compile time to
> foo(**{'a': a, '1+bar': 1+bar})

Chris Angelico wrote:
> That is not guaranteed to work. In another thread it was pointed out
> that this is merely a CPython implementation detail, NOT a language
> feature.

Here's a variant of Anders' suggestion.  First, here's a dict literal
    {'a':1, 'b': 2, 'c':3}
and here's another way to write an equivalent dict
    dict(a=1, b=2, c=3)

So how about extending Python so that, for example,
    {=(1 + bar), }
is equivalent to
    {'1 + bar': 1 + bar, }

The basic idea is Anders's, recast to avoid Chris's problem.

Anders: Are you willing to accept this change, if need be?
Chris: Please speak up, if you think this may depend on CPython.

Off topic:
To show singular possession of a name ending in s or z, some writers
add just an apostrophe. Others also add another s.

More information about the Python-ideas mailing list