Skip to content

Instantly share code, notes, and snippets.

View bsmithyman's full-sized avatar
📎
"It looks like you're writing a distributed web app!"

Brendan Smithyman bsmithyman

📎
"It looks like you're writing a distributed web app!"
View GitHub Profile
amodulename = 'modulename'
try:
import pyximport
pyximport.install()
except:
print('Cython import failed; {0} will use the legacy (pure Python) mode.'.format(amodulename))
from modulenamevanilla import class1, class2, class3
else:
try:
@bsmithyman
bsmithyman / JustTheNumbers
Last active December 17, 2015 17:39
Python gist to take a complicated nested object and grab a list of numbers from it.
import re
parser = re.compile('(?:[0-9\.]+)')
lambda x: [float(item) for item in parser.findall(repr(x))]