This file contains 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
from functools import wraps | |
def w(func): | |
print("wrapping") | |
@wraps(func) | |
def wrapper(*args, **kwargs): | |
print("I'm inside the wrapper") | |
result = func(*args, **kwargs) | |
print("leaving the wrapper") | |
return result |
This file contains 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
# Functions! :) | |
def my_function_without_args(): | |
print("No args here!") | |
def my_function_with_args(first_argument, second_argument): | |
print(f"{first_argument} - {second_argument}") | |
def my_function_using_star_args(*args): | |
print(' '.join([x for x in args])) |
This file contains 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
# coroutine example | |
def look_for(pattern): | |
while True: | |
temp = yield | |
if pattern in temp: | |
print("I found {} in {}!".format(pattern, temp)) | |
else: | |
print("No {} in {}.".format(pattern, temp)) |
This file contains 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
[email protected] | |
[email protected] | |
[email protected] | |
[email protected] | |
[email protected] | |
[email protected] | |
[email protected] | |
[email protected] | |
[email protected] | |
[email protected] |
This file contains 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
from collections import deque | |
# Pull email_data.txt, and join into a big huge string of 1000 random emails. | |
emails = [x.strip() for x in open('email_data.txt', 'r').readlines() if x.strip()] | |
emails = ';'.join(emails) | |
print(emails) | |
def chunks(data, delimiter=";", width=500): | |
pieces = deque(data.split(delimiter)) | |
s = "" |
This file contains 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
start-job -filepath myscript.ps1 -arg (,$myarr) |
This file contains 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
============================================================================== | |
Links for DFW Pythoneers - July 2016 Main Monthly Meeting | |
============================================================================== | |
For now, this is just a dump of my (Ed's) Chrome history. I'll wrap some more | |
context around this later. :-) | |
http://scikit-learn.org/stable/ | |
https://web.stanford.edu/~mwaskom/software/seaborn/ |
This file contains 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
class Test_ThisStuff(object): | |
def setup(self): | |
print('Setting up') | |
self.name = 'Ed' | |
self.age = 38 | |
def teardown(self): | |
print('tearing down') | |
self.name = None |
This file contains 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
import os | |
import json | |
FILE_PATH = './my_data.json' | |
def load_my_list(): | |
# If the file exists, open it and load our list | |
# from the file at FILE_PATH. | |
if os.path.exists(FILE_PATH): |
This file contains 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
import os | |
import pickle | |
FILE_PATH = './my_data.pkl' | |
def load_my_list(): | |
# If the file exists, open it and load our list | |
# from the file at FILE_PATH. | |
if os.path.exists(FILE_PATH): |