Anyway, considering that this has been discussed a lot in the original post
in 2016, I suggest stopping any further discussions here to avoid littering
dev mailing list. Sorry for starting the thread in the first place and
thank you, Jelle, for pointing me to the original discussion.
On Nov 12, 20
Sounds like that happens quite often.
Yep, I totally agree with your point, I think I mentioned something like
this in the post as a possible partial solution: a drop-in replacement for
an ugly list compression people seem to be using now to solve the problem.
It's easy to implement, but the adopt
Do you mean making getitems call itemgetter?
At the moment we can already do with itemgetter:
from operator import itemgetter
a,b = itemgetter("a", "b")(d)
> I tend to post this every time the topic comes up, but: it's highly
> unlikely we'll get syntax for this when we don't even have a bu
12.11.17 12:06, Nick Coghlan пише:
So if folks would like dict unpacking syntax, then a suitable place to
start would be a proposal for a "getitems" builtin that allowed
operations like:
b, a = getitems(d, ("b", "a"))
operator.itemgetter and operator.attrgetter may provide some
inspirati
On 11 November 2017 at 16:22, Jelle Zijlstra wrote:
> 2017-11-10 19:53 GMT-08:00 Ben Usman :
>> I was not able to find any PEPs that suggest this (search keywords:
>> "PEP 445 dicts", "dictionary unpacking assignment", checked PEP-0),
>> however, let me know if I am wrong.
>>
> It was discussed at
On 11 November 2017 at 23:40, Koos Zevenhoven wrote:
> Oops, forgot to reply to the list.
>
>
> On Nov 12, 2017 03:35, "Koos Zevenhoven" wrote:
>
> On Nov 12, 2017 02:12, "Joao S. O. Bueno" wrote:
>
> Ben, I have a small package which enables one to do:
>
> with MapGetter(my_dictionary):
> f
Oops, forgot to reply to the list.
On Nov 12, 2017 03:35, "Koos Zevenhoven" wrote:
On Nov 12, 2017 02:12, "Joao S. O. Bueno" wrote:
Ben, I have a small package which enables one to do:
with MapGetter(my_dictionary):
from my_dictionary import a, b, parameter3
If this interests you, contri
Ben, I have a small package which enables one to do:
with MapGetter(my_dictionary):
from my_dictionary import a, b, parameter3
If this interests you, contributions so it can get hardenned for
mainstram acceptance are welcome.
https://github.com/jsbueno/extradict
On 11 November 2017 at 04:26,
Got it, thank you. I'll go and check it out!
On Nov 11, 2017 01:22, "Jelle Zijlstra" wrote:
>
>
> 2017-11-10 19:53 GMT-08:00 Ben Usman :
>
>> The following works now:
>>
>> seq = [1, 2]
>> d = {'c': 3, 'a': 1, 'b': 2}
>>
>> (el1, el2) = *seq
>> el1, el2 = *seq
>> head, *tail = *seq
>>
>> seq_new
2017-11-10 19:53 GMT-08:00 Ben Usman :
> The following works now:
>
> seq = [1, 2]
> d = {'c': 3, 'a': 1, 'b': 2}
>
> (el1, el2) = *seq
> el1, el2 = *seq
> head, *tail = *seq
>
> seq_new = (*seq, *tail)
> dict_new = {**d, **{'c': 4}}
>
> def f(arg1, arg2, a, b, c):
> pass
>
> f(*seq, **d)
>
> It s
The following works now:
seq = [1, 2]
d = {'c': 3, 'a': 1, 'b': 2}
(el1, el2) = *seq
el1, el2 = *seq
head, *tail = *seq
seq_new = (*seq, *tail)
dict_new = {**d, **{'c': 4}}
def f(arg1, arg2, a, b, c):
pass
f(*seq, **d)
It seems like dict unpacking syntax would not be fully coherent with
list
11 matches
Mail list logo