[issue42356] Dict inline manipulations

2020-11-20 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I agree with Eric suggestion.

--
nosy: +terry.reedy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42356] Dict inline manipulations

2020-11-14 Thread Eric V. Smith


Eric V. Smith  added the comment:

I think you should bring this up on the python-ideas mailing list if you'd like 
to see it discussed. It will likely also require a PEP, similar to PEP 584.

--
nosy: +eric.smith

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42356] Dict inline manipulations

2020-11-14 Thread Tomek H


New submission from Tomek H :

With Python3.9 there is a great feature for merging `dict`s:
{1: 'a'} | {2: 'b'} => {1: 'a', 2: 'b'}


It would be very handy to filter out a dict with a similar fashion (for example 
& operator with a list/tuple/frozenset of keys you want to get back):
{1: 'a', 2: 'b', 3: 'c'} & [1, 3, 4] == {1: 'a', 3: 'c'}
{1: 'a', 2: 'b', 3: 'c'} & {1, 3, 4} == {1: 'a', 3: 'c'}


Also, omitting specified keys (for example - operator with a 
list/tuple/frozenset of keys you want to suppress):
{1: 'a', 2: 'b', 3: 'c'} - [3, 4] == {1: 'a', 2: 'b'}
{1: 'a', 2: 'b', 3: 'c'} - {3, 4} == {1: 'a', 2: 'b'}


Regards!

--
components: Interpreter Core
messages: 380972
nosy: tomek.hlawiczka
priority: normal
severity: normal
status: open
title: Dict inline manipulations
type: enhancement
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com