Re: Treatment of NANs in the statistics module

2018-03-16 Thread Ben Finney
Ben Finney writes: > Steven D'Aprano writes: > > > (1) […] If there is a NAN in your data, the result of calling > > median() is implementation-defined. > > This is the least Pythonic; there is no good reason IMO for specifying a > behaviour in the implementation. That's a confused statement. I

Re: Treatment of NANs in the statistics module

2018-03-16 Thread Ben Finney
Steven D'Aprano writes: > I would like to ask people how they would prefer to handle [the > computation of median when the data set contains NaN]: > > (1) Put the responsibility on the caller to strip NANs from their > data. If there is a NAN in your data, the result of calling median() > is impl

A better solution

2018-03-16 Thread Andrew Z
Hello, im not entirely happy with my solution and would love to hear your suggestions on how to improve the solution. I simplified the task while keeping the code working. Task: financial accounts are described by XML documents. I want to architecture the code to be easily extendible ( easy to

Re: Treatment of NANs in the statistics module

2018-03-16 Thread Steven D'Aprano
On Fri, 16 Mar 2018 22:08:42 -0400, Terry Reedy wrote: > On 3/16/2018 7:16 PM, 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 in the data: [...]

Re: Treatment of NANs in the statistics module

2018-03-16 Thread Terry Reedy
On 3/16/2018 7:16 PM, 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 in the data: https://bugs.python.org/issue33084 I would like to ask people how the

Treatment of NANs in the statistics module

2018-03-16 Thread Steven D'Aprano
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 in the data: https://bugs.python.org/issue33084 I would like to ask people how they would prefer to handle this issue: (1) Put

Re: urllib.request.urlopen fails with https - SOLVED

2018-03-16 Thread Irv Kalb
Thank you, thank you, thank you. That fixed it (at least on my computer, I'll see if I can do that at my school). Irv > On Mar 15, 2018, at 7:39 PM, Ned Deily wrote: > > On 2018-03-14 18:04, Irv Kalb wrote: >> File >> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/re

Re: Make synchronous generator from an asynchronous generator

2018-03-16 Thread Julien Salort
Le 16/03/2018 à 16:55, Ian Kelly a écrit : Note that this function can't be called more than once, because it closes the event loop at the end. Next time you call it it will get the closed event loop and try to schedule on it and then raise an exception because it's closed. Ah ok. So, if I repl

Re: Make synchronous generator from an asynchronous generator

2018-03-16 Thread Ian Kelly
On Thu, Mar 15, 2018 at 1:35 PM, Julien Salort wrote: > Because I wanted to keep the synchronous function for scripts which used it, > without unnecessarily duplicating the code, I built also a synchronous > function from this new asynchronous one, like that: > > def acquire_to_files(self, *args

Make synchronous generator from an asynchronous generator

2018-03-16 Thread Julien Salort
Hello, I have recently got the need to convert a synchronous function to asynchronous function because I needed to run three of them concurrently. Since I am using Python 3.6, I used async def and asyncio and that has worked out great. Thank you guys for making this possible. Because I want