Re: Keys in dict and keys not in dict

2018-03-18 Thread Chris Angelico
On Mon, Mar 19, 2018 at 3:18 PM, Ben Finney wrote: > Chris Angelico writes: > >> Sounds like a set operation to me. >> >> expected = {"foo", "bar", "spam"} >> missing = expected - set(json) > > That works (because iterating a dict returns its keys). But it is less > immediately understandable, IM

Re: Keys in dict and keys not in dict

2018-03-18 Thread Ben Finney
Chris Angelico writes: > Sounds like a set operation to me. > > expected = {"foo", "bar", "spam"} > missing = expected - set(json) That works (because iterating a dict returns its keys). But it is less immediately understandable, IMO, than this:: expected = {"foo", "bar", "spam"} missin

Re: Keys in dict and keys not in dict

2018-03-18 Thread Chris Angelico
On Mon, Mar 19, 2018 at 2:32 PM, Andrew Z wrote: > hello, > > i'd like to check if a function parameter (json) has all the keys I expect > it to have and if it doesn't - point out the one that is missing. > > What's the good way of doing that? > > "good way" - something concise... i'd like to av

Keys in dict and keys not in dict

2018-03-18 Thread Andrew Z
hello, i'd like to check if a function parameter (json) has all the keys I expect it to have and if it doesn't - point out the one that is missing. What's the good way of doing that? "good way" - something concise... i'd like to avoid using : if key in json: #pass else print(" Oops, i

Re: TLSServer: certificate one request behind...

2018-03-18 Thread Fabiano Sidler
Hello? Rfd, anyone? Thus wrote Fabiano Sidler: > Thus wrote Fabiano Sidler: > > What's the reason for this? Please find attached my TLSServer. > > Oh, sorry...! Apparently, the attachment has been stripped. Here inline: > > === tlsserver.py === > from socketserver import ThreadingTCPServer,Strea

Re: Treatment of NANs in the statistics module

2018-03-18 Thread Rustom Mody
On Saturday, March 17, 2018 at 3:22:46 PM UTC+5:30, Léo El Amri wrote: > On 17/03/2018 00:16, Steven D'Aprano wrote: > > The bug tracker currently has a discussion of a bug in the median(), > > median_low() and median_high() functions that they wrongly compute the > > medians in the face of NANs