Three good StackOverflow answers on Python topics
Here are three thorough answers on Python topics from StackOverflow. Metaclasses Yield, iterables, iterators, generators Decorators
Here are three thorough answers on Python topics from StackOverflow. Metaclasses Yield, iterables, iterators, generators Decorators
Apache Cassandra is a column-store with a p2p distribution architecture. Yesterday I did a presentation about Cassandra at Grontmij, Glostrup, Denmark. I made the slides in Google Docs, and they’re public: slides.
How complicated does a mathematical function, pseudorandom(x), have to be to create something that seems random, and how do you check whether it seems random? Looking at a long list of numbers is not a good way, because our ability…
If you run ‘ll -l’ sometimes a file has ‘@’ permission. This means that the file has extended attributes. TextMate may extended attributes to a file. Consider a fictional Python file called xxx.py edited with TextMate: View extended attributes: $…
given a (2D) array a, and a smaller (2D) array b, how can you add the smaller array to the bigger array at some offset in numpy? >>> a = zeros((4,4), dtype=int) >>> a array([[0, 0, 0, 0], [0, 0,…
Mostly so I myself can remember how to do it, here is how to create a random geotiff with GDAL in Python Note: the width and height are given in opposite order in the GDAL raster and numpy arrays! import…
This is a good post showing how “perrygeo” uses Cython to speed up a pure Python function. The comments also discuss alternatives and options: Using psyco instead of Cython Using optimization flags for gcc Using xxx instead of math.xxx
How long does [insert code snippet] take in Python? Find out with the timeit module, in Python since 2.3. Below I time how long it takes to make a list with a 1000 zeros, [0,0,0,…], using different Python code snippets.…
pyproj is a Python interface to the PROJ.4 () functions. It allows you to transform coordinates between coordinate systems. Install pyproj using pip Assuming you’re using pip to install Python packages: $ pip install pyproj
I tried the Tor browser today, and was amazed at how slow it was. As Tor’s user base has grown, the performance of the Tor network has suffered. This document describes the current understanding of why Tor is slow, and…