Hi, I'm Harlin and welcome to my blog. I write about Python, Alfresco and other cheesy comestibles.

Python - How to Use Counters to Make Counting Easier

One use case for dictionaries is to pull data from a file or other steam and make a count of occurrences of substrings.

The Counter object is available for quick and easy calculations based on a list of objects and their counts.

Python's Counter object is an unordered collection ...

Read More

Python - How to Stack the Deque - Working with Deque Data Structures

A deque object is similar to a stack or a queue and is initialized left-to-right from an iterable value (or empty). In case you're wondering, deque is pronounced "deck" and stands for "double-ended queue."

Deques are thread-safe and memory efficient. They can be appended, extended or "popped" from either ...

Read More

Python - Namedtuples Examples

Namedtuples are tuples turned into convenient containers for simple tasks. The standard tuple will only have integer indexes for accessing individual members. For example:

>>> trees = ["pecan", "oak", "hickory"]

To access these individually, I would need to do:

>>> trees[1]
 "oak"

Namedtuples are tuples that allow you to access ...

Read More