Re: [Python-ideas] Thoughts on "extended mapping unpacking"

2018-05-24 Thread MRAB
On 2018-05-24 18:08, George Leslie-Waksman wrote: I have had plenty of instances where destructuring a mapping would have be convenient. Relating to iterable destructuring, I would expect the syntax to be of the form "variable: key". I also think the curly-braces make it harder to visually pars

Re: [Python-ideas] Thoughts on "extended mapping unpacking"

2018-05-24 Thread George Leslie-Waksman
I have had plenty of instances where destructuring a mapping would have be convenient. Relating to iterable destructuring, I would expect the syntax to be of the form "variable: key". I also think the curly-braces make it harder to visually parse what's going on. So I might suggest something a litt

Re: [Python-ideas] Thoughts on "extended mapping unpacking"

2018-05-24 Thread Serhiy Storchaka
24.05.18 18:46, Neil Girdhar пише: p = parameters.pop('some_parameter') q = parameters.pop('some_other_parameter') if parameters:      raise ValueError parameters is a Mapping subclass and I don't want to destroy it Oh, right. It works if parameters is a var-keyword parameter.

Re: [Python-ideas] Thoughts on "extended mapping unpacking"

2018-05-24 Thread Neil Girdhar
On Thu, May 24, 2018 at 8:00 AM Serhiy Storchaka wrote: > 24.05.18 11:38, Neil Girdhar пише: > > I was previously constructing an object like this: > > > > tb = TemporalBehavior(**kwargs, **parameters) > > > > where various subclasses were doing things like > > > > def __init__(self, some_kwarg,

Re: [Python-ideas] Thoughts on "extended mapping unpacking"

2018-05-24 Thread Serhiy Storchaka
24.05.18 11:38, Neil Girdhar пише: I was previously constructing an object like this: tb = TemporalBehavior(**kwargs, **parameters) where various subclasses were doing things like def __init__(self, some_kwarg, some_other_kwargs, some_parameter, some_other_parameter): Then I realized that I

[Python-ideas] Thoughts on "extended mapping unpacking"

2018-05-24 Thread Neil Girdhar
I was previously constructing an object like this: tb = TemporalBehavior(**kwargs, **parameters) where various subclasses were doing things like def __init__(self, some_kwarg, some_other_kwargs, some_parameter, some_other_parameter): Then I realized that I want to pass the paramters as a dicti