Re: on a very slow function

2017-10-02 Thread Daniel Bastos
Ben Bacarisse <ben.use...@bsb.me.uk> writes: > Daniel Bastos <dbas...@toledo.com> writes: > >> def make_sequence_non_recursive(N, x0 = 2, c = -1): >> "What's wrong with this function? It's very slow." >> last = x0 >> def sequence():

Re: on a very slow function

2017-10-02 Thread Daniel Bastos
Chris Angelico writes: [...] > Maybe "linear_congruential" would be a good name for the function? I > don't know. Sounds good to me --- in absence of a smaller name. > Anyhow, the basic memoization technique should help you some. It did! Thanks so much to you and to

Re: on a very slow function

2017-10-02 Thread Daniel Bastos
r...@zedat.fu-berlin.de (Stefan Ram) writes: > Daniel Bastos <dbas...@toledo.com> writes: >> That function produces a function which yields the values of the >> sequence x^2 - 1 mod N > > Thats a term with two free variables. > I am not sure what the sequence is.

Re: on a very slow function

2017-10-01 Thread Daniel Bastos
Chris Angelico <ros...@gmail.com> writes: > On Mon, Oct 2, 2017 at 8:27 AM, Daniel Bastos <dbas...@toledo.com> wrote: >> def make_sequence_non_recursive(N, x0 = 2, c = -1): >> "What's wrong with this function? It's very slow." >> last = x

on a very slow function

2017-10-01 Thread Daniel Bastos
def make_sequence_non_recursive(N, x0 = 2, c = -1): "What's wrong with this function? It's very slow." last = x0 def sequence(): nonlocal last next = last last = last**2 + c return next % N return sequence It crawls pretty soon. Please advise? Thank you. >>> f =

Re: "Best" websocket implementation for Python 2.x?

2017-03-09 Thread Daniel Bastos
Skip Montanaro writes: [...] > These two packages would appear to have stalled. Looking around, I also > found > > ws4py > websockets - Python 3.3 or later > autobahn.websocket > > There are probably others I haven't yet stumbled upon. (I'd continue poking > around