This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# singleton.py illustrates how to use singleton design pattern in python | |
# influenced by Trevor Pain https://www.youtube.com/watch?v=6IV_FYx6MQA | |
# Author: Aaron Phalen | Twitter: @aaron_phalen | Email: [email protected] | |
# In python, a singleton is a design patter which allows once instance of a class to be invoked | |
# or stored in memory. | |
class Singleton(object): | |
_instance = None | |
def __new__(self): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# python_itertools.py highlights useful functions in python's itertools module | |
# Influenced by Raymond Chandler III pyvideo.org/video/2275 (Super Advanced Python Concepts) | |
# Author: Aaron Phalen | Twitter: @aaron_phalen | Email: [email protected] | |
from itertools import chain, combinations, permutations, compress, count, cycle, groupby | |
# 1. Itertools Chain Example | |
letters = ["a", "b", "c", "d"] | |
numbers = [1, 2, 3] | |
both = chain(letters, numbers) |
NewerOlder