Nadav Wexler wrote:
> Hi,
> That is my first post here, I hope it's the right place for it.
> so I was using some dicts had the following code:
> env = dict(t for t in os.environ.items() if 'SUBSTRING' not in t[0])
> and I thought: It could have really been nice if i could do:
> env = dict(t for t in os.environ.items() if 'SUBSTRING' not in
> t.key)
> now I see that environ is not exactly a dict, but i think this is useful
> for all dictionary types. on the other hand, dicts are everywhere and i'm
> not sure about the performance impact of this for those that just ignore
> the access by attribute.
> of course, a matching t.value must be in place as well. ;)
> I would have opened a PR just to try out, but I feel this is so in the core
> that I'd first like to hear some comments.
> I was searching if anyone else had this idea before but couldn't find
> anything.
> Thanks,
> Nadav
`env = {key: value for key, value in os.environ.items() if 'SUBSTRING' not in
key}`
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/5AERAPNDPAN4DEWNPKGBNEGQPFIXGEB2/
Code of Conduct: http://python.org/psf/codeofconduct/