Thomas Dybdahl Ahle added the comment:
Installing libffi-dev worked for me.
--
nosy: +thomasahle
___
Python tracker
<https://bugs.python.org/issue31652>
___
___
New submission from Thomas Dybdahl Ahle :
Given a generator `f()` we can use `random.sample(list(f()), 10)` to get a
uniform sample of the values generated.
This is fine, and fast, as long as `list(f())` easily fits in memory.
However, if it doesn't, one has to implement the reservoir sam
Thomas Dybdahl Ahle added the comment:
Just wanted to add another use-case. In a project I'm working on, we are
building a lot of graphs using code like this:
```
nodes = [
Node('node-name1',
children=[...],
classifier=has_foo),
Node('node-name2
Thomas Dybdahl Ahle added the comment:
I don't know if it's worth the overhead to implement a multiselect, given we
only expose a median function.
I've rewritten select2 to be intro, just falling back on sorting. This doesn't
appear to degrade the performance.
I also ad
Thomas Dybdahl Ahle added the comment:
I think "minimize expected-case time" is a good goal. If we wanted "minimize
worst-case time" we would have to use k-means rather than quickselect.
My trials on random data, where sort arguably has a disadvantage, suggests
sorting is
Thomas Dybdahl Ahle added the comment:
If you have a good, realistic test set, we can try testing quick-select vs
sorting. If it's still not good, I can also reimplement it in C.
--
___
Python tracker
<http://bugs.python.org/is
Thomas Dybdahl Ahle added the comment:
I have written some proof of concept code here [1], I would appreciate you
commenting on it, before I turn it into a patch, as I haven't contributed code
to Python before.
I have tried to write it as efficiently as possible, but it is of course
pos
New submission from Thomas Dybdahl Ahle:
The statistics module currently contains the following comment:
"FIXME: investigate ways to calculate medians without sorting? Quickselect?"
This is important, because users expect standard library functions to use state
of the art implementa
Thomas Dybdahl Ahle added the comment:
For anyone who finds this through google,
if you are finding the inverse mod a prime, you can use fermats little theorem:
pow(a, -1, mod) = pow(a, a-2, mod).
(You also need that mod doesn't divide a).
--
nosy: +Thomas.Dybdahl
Thomas Dybdahl Ahle added the comment:
I'm sorry. I see the problem then.
Do you know, if there are any plans of adding a fast balanced binary search
tree to pythons stdlib?
--
___
Python tracker
<http://bugs.python.org/i
Thomas Dybdahl Ahle added the comment:
Why not just add support to the set container?
As far as I know, it is a binary search tree, so supporting random picking in
O(logn) should be easy.
--
nosy: +Thomas.Dybdahl.Ahle
___
Python tracker
<h
Thomas Dybdahl Ahle added the comment:
> which means no global namespace access
Does that mean that you cannot use len and range in a Thread?
--
nosy: +lobais
_
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/
Thomas Dybdahl Ahle added the comment:
I run this now in the beginning of my code. As far as I can see it works
fine.
if not hasattr(Thread, "_Thread__bootstrap_inner"):
class SafeThread (Thread):
def encaps(self):
try:
self._Thread__boots
Thomas Dybdahl Ahle added the comment:
The fix looks nice.
I'll just implement it locally in my app for python < 2.4.
Thanks
__
Tracker <[EMAIL PROTECTED]>
<http://bugs.pyt
New submission from Thomas Dybdahl Ahle:
I have a pygtk program, that uses a fairly lot of threads in a pool. All
of these threads are setDaemon to ensure the application shuts down when
I call gtk.main_quit()
About every second time I close the app, I get one or more errors from
places in the
15 matches
Mail list logo