python Programming Glossary: xs
Python faster than compiled Haskell? http://stackoverflow.com/questions/10357663/python-faster-than-compiled-haskell Here is Haskell quicksort Ord a a a quicksort quicksort p xs quicksort lesser p quicksort greater where lesser filter p xs.. quicksort lesser p quicksort greater where lesser filter p xs greater filter p xs main do file readFile data let un lines.. greater where lesser filter p xs greater filter p xs main do file readFile data let un lines file let f map x read..
Python/matplotlib : plotting a 3d cube, a sphere and a vector? http://stackoverflow.com/questions/11140163/python-matplotlib-plotting-a-3d-cube-a-sphere-and-a-vector proj3d class Arrow3D FancyArrowPatch def __init__ self xs ys zs args kwargs FancyArrowPatch.__init__ self 0 0 0 0 args.. self 0 0 0 0 args kwargs self._verts3d xs ys zs def draw self renderer xs3d ys3d zs3d self._verts3d xs.. args kwargs self._verts3d xs ys zs def draw self renderer xs3d ys3d zs3d self._verts3d xs ys zs proj3d.proj_transform xs3d..
Python List Comprehension Vs. Map http://stackoverflow.com/questions/1247486/python-list-comprehension-vs-map map when using exactly the same function python mtimeit s'xs range 10 ' 'map hex xs ' 100000 loops best of 3 4.86 usec per.. the same function python mtimeit s'xs range 10 ' 'map hex xs ' 100000 loops best of 3 4.86 usec per loop python mtimeit s'xs.. 100000 loops best of 3 4.86 usec per loop python mtimeit s'xs range 10 ' ' hex x for x in xs ' 100000 loops best of 3 5.58..
2D and 3D Scatter Histograms from arrays in Python http://stackoverflow.com/questions/14002480/2d-and-3d-scatter-histograms-from-arrays-in-python as pyplot ax np.histogram2d x_data y_data bins bins xs ax 1 dx xs 1 xs 0 ys ax 2 dy ys 1 ys 0 def rdn return 1 1 np.random.random.. ax np.histogram2d x_data y_data bins bins xs ax 1 dx xs 1 xs 0 ys ax 2 dy ys 1 ys 0 def rdn return 1 1 np.random.random.. ax np.histogram2d x_data y_data bins bins xs ax 1 dx xs 1 xs 0 ys ax 2 dy ys 1 ys 0 def rdn return 1 1 np.random.random 1..
python histogram one-liner http://stackoverflow.com/questions/2870466/python-histogram-one-liner and do it in 2 lines d defaultdict int for x in xs d x 1 That's clean efficient Pythonic and much easier for most..
Python thread pool similar to the multiprocessing Pool? http://stackoverflow.com/questions/3033952/python-thread-pool-similar-to-the-multiprocessing-pool p c_func_no_gil p p multiprocessing.Pool 4 xs p.map long_running_func range 100 however I would like to do..
|