[Python-ideas] Add a method to get the subset of a dictionnary.

Ares Ou aresowj at gmail.com
Fri Nov 11 16:39:29 EST 2016


>
> On 10/12/2016 5:52 PM, Terry Reedy wrote:
>
> Test code before posting.  The above is a set comprehension creating a
> set of tupes.
> I should have followed my own advice.  The above is a SyntaxError until
> 'k,v' is wrapped in parens, '(k,v)'.

On 10/12/2016 12:06 PM, Enguerrand Pelletier wrote:
>
b = {k, v for k,v in a.items() if k in interesting_keys}
>>
>
Just my own opinion, I don't pretty much get you on adding a method
generating Sets to the dictionary object.


Best regards,
Ares Ou

*Software Engineer / Full-Stack Python Developer*

*Blog:* http://aresou.net  |  *Github:* https://github.com/aresowj
*Stack Overflow:* http://stackoverflow.com/users/5183727/ares-ou

Ares Ou

On Wed, Oct 12, 2016 at 3:03 PM, Terry Reedy <tjreedy at udel.edu> wrote:

> On 10/12/2016 5:52 PM, Terry Reedy wrote:
>
>> On 10/12/2016 12:06 PM, Enguerrand Pelletier wrote:
>>
>
> b = {k, v for k,v in a.items() if k in interesting_keys}
>>>
>>
>> Test code before posting.  The above is a set comprehension creating a
>> set of tupes.
>>
>
> I should have followed my own advice.  The above is a SyntaxError until
> 'k,v' is wrapped in parens, '(k,v)'.
>
>
> --
> Terry Jan Reedy
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20161111/6883883b/attachment.html>


More information about the Python-ideas mailing list