Various Code Snippets on different topics about Python
-
[namedtuple_benchmark] (namedtuple_benchmark.py)
An example of comparison between namedtuple and dict assignment. Shows the cost of readability of namedtuples over dict's integer index.
-
[mmap] (mmap)
Examples on how to use mmap module in python. Includes reading, writing (using slices and only in memory a.k.a. ACCESS_COPY) and regex finds. The example comes from PYMOTW article on mmap.
-
Sorting
Code snippets demonstrating various sorting algorithms implemented in Python. See tests.py for written tests.
-
[merge_sort] (merge_sort.py)
-
Color in terminal
-
Requests - Requests-futures
A small example in terms of demonstrating the parallelization of requests-futures package. Syncronous example using plain requests and Asyncronous example using requests-futures
